X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fif.t;h=d09de5895c252a0c64da01e0e0abc0f9da5dae8a;hb=e28bb1d52bee845e0aab3d253cd27698a545c674;hp=12ad0b0c390d7e74a242fa1cd07bbc231a5ca2cd;hpb=cd16c24cb16bb0bd0fa486b8e98c39fcf6ebcf5c;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/if.t b/lib/if.t index 12ad0b0..d09de58 100644 --- a/lib/if.t +++ b/lib/if.t @@ -1,15 +1,26 @@ #!./perl BEGIN { - chdir 't' if -d 't'; - @INC = '../lib'; + chdir 't' and @INC = '../lib' if $ENV{PERL_CORE}; } -use Test::More tests => 4; +my $t = 1; +print "1..5\n"; +sub ok { + print "not " unless shift; + print "ok $t # ", shift, "\n"; + $t++; +} my $v_plus = $] + 1; my $v_minus = $] - 1; +unless (eval 'use open ":std"; 1') { + # pretend that open.pm is present + $INC{'open.pm'} = 'open.pm'; + eval 'sub open::foo{}'; # Just in case... +} + ok( eval "use if ($v_minus > \$]), strict => 'subs'; \${'f'} = 12" eq 12, '"use if" with a false condition, fake pragma'); @@ -24,3 +35,7 @@ ok( (not defined eval "use if ($v_plus > \$]), strict => 'refs'; \${'f'} = 12" and $@ =~ /while "strict refs" in use/), '"use if" with a true condition and a pragma'); +# Old version had problems with the module name `open', which is a keyword too +# Use 'open' =>, since pre-5.6.0 could interpret differently +ok( (eval "use if ($v_plus > \$]), 'open' => IN => ':crlf'; 12" || 0) eq 12, + '"use if" with open');