Change 29824 by [EMAIL PROTECTED] on 2007/01/15 13:44:39

        Simplify the ok/not ok logic
        (another refactorisation by Schwern)

Affected files ...

... //depot/perl/t/lib/common.pl#6 edit

Differences ...

==== //depot/perl/t/lib/common.pl#6 (text) ====
Index: perl/t/lib/common.pl
--- perl/t/lib/common.pl#5~29823~       2007-01-15 05:40:18.000000000 -0800
+++ perl/t/lib/common.pl        2007-01-15 05:44:39.000000000 -0800
@@ -156,21 +156,25 @@
     }
     die "$0: can't have OPTION regex and random\n"
         if $option_regex + $option_random > 1;
-    my $ok = 1;
-    if ( $results =~ s/^SKIPPED\n//) {
+    my $ok = 0;
+    if ($results =~ s/^SKIPPED\n//) {
        print "$results\n" ;
+       $ok = 1;
     }
     elsif ($option_random) {
         $ok = randomMatch($results, $expected);
     }
-    elsif (($prefix  && (( $option_regex && $results !~ /^$expected/) ||
-                        (!$option_regex && $results !~ /^\Q$expected/))) or
-          (!$prefix && (( $option_regex && $results !~ /^$expected/) ||
-                        (!$option_regex && $results ne $expected))))
-    {
-       print_err_line( $switch, $prog, $expected, $results, $todo );
-        $ok = 0;
+    elsif ($option_regex) {
+       $ok = $results =~ /^$expected/;
     }
+    elsif ($prefix) {
+       $ok = $results =~ /^\Q$expected/;
+    }
+    else {
+       $ok = $results eq $expected;
+    }
+ 
+    print_err_line( $switch, $prog, $expected, $results, $todo ) unless $ok;
 
     our $TODO = $todo ? $todo_reason : 0;
     ok($ok);
End of Patch.

Reply via email to