extra code in pp_concat, Take 2
[p5sagit/p5-mst-13.2.git] / lib / if.t
CommitLineData
cd16c24c 1#!./perl
2
3BEGIN {
78bfd9a9 4 chdir 't' and @INC = '../lib' if $ENV{PERL_CORE};
cd16c24c 5}
6
2f761939 7my $t = 1;
8print "1..5\n";
9sub ok {
10 print "not " unless shift;
11 print "ok $t # ", shift, "\n";
12 $t++;
13}
cd16c24c 14
15my $v_plus = $] + 1;
16my $v_minus = $] - 1;
17
2f761939 18unless (eval 'use open ":std"; 1') {
19 # pretend that open.pm is present
20 $INC{'open.pm'} = 'open.pm';
21 eval 'sub open::foo{}'; # Just in case...
22}
23
cd16c24c 24
25ok( eval "use if ($v_minus > \$]), strict => 'subs'; \${'f'} = 12" eq 12,
26 '"use if" with a false condition, fake pragma');
27
28ok( eval "use if ($v_minus > \$]), strict => 'refs'; \${'f'} = 12" eq 12,
29 '"use if" with a false condition and a pragma');
30
31ok( eval "use if ($v_plus > \$]), strict => 'subs'; \${'f'} = 12" eq 12,
32 '"use if" with a true condition, fake pragma');
33
34ok( (not defined eval "use if ($v_plus > \$]), strict => 'refs'; \${'f'} = 12"
35 and $@ =~ /while "strict refs" in use/),
36 '"use if" with a true condition and a pragma');
37
2f761939 38# Old version had problems with the module name `open', which is a keyword too
39# Use 'open' =>, since pre-5.6.0 could interpret differently
40ok( (eval "use if ($v_plus > \$]), 'open' => IN => ':crlf'; 12" || 0) eq 12,
41 '"use if" with open');