This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Actually generate full failure diagnostics in checkErrs() in B's OptreeCheck,
authorNicholas Clark <nick@ccl4.org>
Fri, 4 Feb 2011 16:59:42 +0000 (16:59 +0000)
committerNicholas Clark <nick@ccl4.org>
Fri, 4 Feb 2011 16:59:42 +0000 (16:59 +0000)
3857d07c85882fa8 used if() where unless() would have been correct. However, I
didn't spot this because

a: none of the tests fail so none are trying to generate diagnostics
b: the code as written is silent if there are no errors

Hence make the code be called unconditionally, which simplifies things.

Remove the vestigial forced fail() if $gOpts{fail} is true.

ext/B/t/OptreeCheck.pm

index 4bbe32b..8cb97b9 100644 (file)
@@ -556,15 +556,14 @@ sub checkErrs {
     @missed = sort @missed;
     my @got = sort keys %goterrs;
 
-    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;
+    if (@{$tc->{errs}}) {
+       is(@missed + @got, 0, "Only got expected errors for $tc->{name}")
+    } else {
+       # @missed must be 0 here.
+       is(scalar @got, 0, "Got no errors for $tc->{name}")
     }
-
-    fail("FORCED: $tc->{name}:\n") if $gOpts{fail}; # silly ?
+    _diag(join "\n", "got unexpected:", @got) if @got;
+    _diag(join "\n", "missed expected:", @missed) if @missed;
 }
 
 =head1 mkCheckRex ($tc)