diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-02-04 16:02:38 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-02-04 16:04:47 +0000 |
commit | 3857d07c85882fa81d5e5c1ce2867e8c957747d0 (patch) | |
tree | f15227c1b33c71aa1f7f95ae4baf6000421122a5 /ext | |
parent | 3f47291432d23a4da5e85270f0a5e356ca6994ff (diff) | |
download | perl-3857d07c85882fa81d5e5c1ce2867e8c957747d0.tar.gz |
In B's OptreeCheck, always report inconsistent errors as a failed test.
Previously there were 3 different options, and the default was to print a
diagnostic (which obviously can get missed). Remove the options - tests are
tests. As this means that most calls to checkOptree() now make two tests
rather than one, update many of the test scripts' plans.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/B/t/OptreeCheck.pm | 37 | ||||
-rw-r--r-- | ext/B/t/f_map.t | 2 | ||||
-rw-r--r-- | ext/B/t/f_sort.t | 2 | ||||
-rw-r--r-- | ext/B/t/optree_check.t | 2 | ||||
-rw-r--r-- | ext/B/t/optree_concise.t | 2 | ||||
-rw-r--r-- | ext/B/t/optree_constants.t | 2 | ||||
-rw-r--r-- | ext/B/t/optree_misc.t | 4 | ||||
-rw-r--r-- | ext/B/t/optree_samples.t | 2 | ||||
-rw-r--r-- | ext/B/t/optree_sort.t | 2 | ||||
-rw-r--r-- | ext/B/t/optree_specials.t | 2 | ||||
-rw-r--r-- | ext/B/t/optree_varinit.t | 2 |
11 files changed, 19 insertions, 40 deletions
diff --git a/ext/B/t/OptreeCheck.pm b/ext/B/t/OptreeCheck.pm index fc374aa3c4..4bbe32b5fa 100644 --- a/ext/B/t/OptreeCheck.pm +++ b/ext/B/t/OptreeCheck.pm @@ -263,17 +263,6 @@ checkErrs() is a getRendering helper that verifies that expected errs against those found when rendering the code on the platform. It is run after rendering, and before mkCheckRex. -Errors can be reported 3 different ways; diag, fail, print. - - diag - uses test.pl _diag() - fail - causes double-testing - print-.no # in front of the output (may mess up test harnesses) - -The 3 ways are selectable at runtimve via cmdline-arg: -report={diag,fail,print}. - - - =cut use Config; @@ -312,10 +301,6 @@ our %gOpts = # values are replaced at runtime !! help => [0, 'provides help and exits', 0], testmode => [qw/ native cross both /], - # reporting mode for rendering errs - report => [qw/ diag fail print /], - errcont => [1, 'if 1, tests match even if report is fail', 0], - # fixup for VMS, cygwin, which don't have stderr b4 stdout rxnoorder => [1, 'if 1, dont req match on -e lines, and -banner',0], strip => [1, 'if 1, catch errs and remove from renderings',0], @@ -568,21 +553,15 @@ sub checkErrs { } } - # relook at altered - if (@missed or %goterrs) { - my @lines; - push @lines, "got unexpected:", sort keys %goterrs if %goterrs; - push @lines, "missed expected:", sort @missed if @missed; + @missed = sort @missed; + my @got = sort keys %goterrs; - if (@lines) { - unshift @lines, $tc->{name}; - my $report = join("\n", @lines); - - if ($gOpts{report} eq 'diag') { _diag ($report) } - elsif ($gOpts{report} eq 'fail') { fail ($report) } - else { print ($report) } - next unless $gOpts{errcont}; # skip block - } + if (@{$tc->{errs}} + ? is(@missed + @got, 0, "Only got expected errors for $tc->{name}") + : is(scalar @got, 0, "Got no errors for $tc->{name}") # @missed must be 0 here. + ) { + _diag(join "\n", "got unexpected:", @got) if @got; + _diag(join "\n", "missed expected:", @missed) if @missed; } fail("FORCED: $tc->{name}:\n") if $gOpts{fail}; # silly ? diff --git a/ext/B/t/f_map.t b/ext/B/t/f_map.t index 00bb31e78a..9f323b8cc1 100644 --- a/ext/B/t/f_map.t +++ b/ext/B/t/f_map.t @@ -13,7 +13,7 @@ BEGIN { } } use OptreeCheck; -plan tests => 9; +plan tests => 18; =head1 f_map.t diff --git a/ext/B/t/f_sort.t b/ext/B/t/f_sort.t index 1ebeb24357..51f2aa559f 100644 --- a/ext/B/t/f_sort.t +++ b/ext/B/t/f_sort.t @@ -13,7 +13,7 @@ BEGIN { } } use OptreeCheck; -plan tests => 20; +plan tests => 40; =head1 f_sort.t diff --git a/ext/B/t/optree_check.t b/ext/B/t/optree_check.t index 1c55fb601c..bcbb5549ec 100644 --- a/ext/B/t/optree_check.t +++ b/ext/B/t/optree_check.t @@ -26,7 +26,7 @@ cmdline args in 'standard' way across all clients of OptreeCheck. =cut -plan tests => 5 + 15 + 16 * $gOpts{selftest}; # pass()s + $#tests +plan tests => 5 + 15 + 12 + 16 * $gOpts{selftest}; # pass()s + $#tests pass("REGEX TEST HARNESS SELFTEST"); diff --git a/ext/B/t/optree_concise.t b/ext/B/t/optree_concise.t index a72e7c857c..aa28ebb14c 100644 --- a/ext/B/t/optree_concise.t +++ b/ext/B/t/optree_concise.t @@ -17,7 +17,7 @@ BEGIN { use OptreeCheck; # ALSO DOES @ARGV HANDLING !!!!!! use Config; -plan tests => 23; +plan tests => 41; $SIG{__WARN__} = sub { my $err = shift; diff --git a/ext/B/t/optree_constants.t b/ext/B/t/optree_constants.t index b90c874dbb..7b1d2672a6 100644 --- a/ext/B/t/optree_constants.t +++ b/ext/B/t/optree_constants.t @@ -16,7 +16,7 @@ BEGIN { use OptreeCheck; # ALSO DOES @ARGV HANDLING !!!!!! use Config; -plan tests => 30; +plan tests => 57; ################################# diff --git a/ext/B/t/optree_misc.t b/ext/B/t/optree_misc.t index a7bf436d7b..4c3ea1457f 100644 --- a/ext/B/t/optree_misc.t +++ b/ext/B/t/optree_misc.t @@ -10,10 +10,10 @@ BEGIN { } use OptreeCheck; use Config; -plan tests => 3; +plan tests => 6; SKIP: { -skip "no perlio in this build", 2 unless $Config::Config{useperlio}; +skip "no perlio in this build", 4 unless $Config::Config{useperlio}; # The regression this is testing is that the first aelemfast, derived # from a lexical array, is supposed to be a BASEOP "<0>", while the diff --git a/ext/B/t/optree_samples.t b/ext/B/t/optree_samples.t index 82f8817181..3cc0f266c5 100644 --- a/ext/B/t/optree_samples.t +++ b/ext/B/t/optree_samples.t @@ -14,7 +14,7 @@ BEGIN { } use OptreeCheck; use Config; -plan tests => 20; +plan tests => 34; pass("GENERAL OPTREE EXAMPLES"); diff --git a/ext/B/t/optree_sort.t b/ext/B/t/optree_sort.t index 97d3d78f1a..b602e436a5 100644 --- a/ext/B/t/optree_sort.t +++ b/ext/B/t/optree_sort.t @@ -14,7 +14,7 @@ BEGIN { } use OptreeCheck; use Config; -plan tests => 11; +plan tests => 21; pass("SORT OPTIMIZATION"); diff --git a/ext/B/t/optree_specials.t b/ext/B/t/optree_specials.t index 5945f9115a..b8b9078c18 100644 --- a/ext/B/t/optree_specials.t +++ b/ext/B/t/optree_specials.t @@ -20,7 +20,7 @@ BEGIN { use OptreeCheck; # ALSO DOES @ARGV HANDLING !!!!!! use Config; -plan tests => 7 + ($] > 5.009 ? 1 : 0); +plan tests => 13 + ($] > 5.009 ? 2 : 0); require_ok("B::Concise"); diff --git a/ext/B/t/optree_varinit.t b/ext/B/t/optree_varinit.t index ca3ad232c9..e0a95b7652 100644 --- a/ext/B/t/optree_varinit.t +++ b/ext/B/t/optree_varinit.t @@ -14,7 +14,7 @@ BEGIN { } use OptreeCheck; use Config; -plan tests => 22; +plan tests => 42; pass("OPTIMIZER TESTS - VAR INITIALIZATION"); |