From: Rafael Garcia-Suarez Date: Mon, 15 Jan 2007 13:44:39 +0000 (+0000) Subject: Simplify the ok/not ok logic X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7702f0766f7a5815f7c5444edd9fa7ec7c739726;p=p5sagit%2Fp5-mst-13.2.git Simplify the ok/not ok logic (another refactorisation by Schwern) p4raw-id: //depot/perl@29824 --- diff --git a/t/lib/common.pl b/t/lib/common.pl index c60fd94..8492f13 100644 --- a/t/lib/common.pl +++ b/t/lib/common.pl @@ -156,21 +156,25 @@ for (@prgs){ } 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);