4 use Test::More tests => 10;
9 unless (eval 'use open ":std"; 1') {
10 # pretend that open.pm is present
11 $INC{'open.pm'} = 'open.pm';
12 eval 'sub open::foo{}'; # Just in case...
17 is( eval "use if ($v_minus > \$]), strict => 'subs'; \${'f'} = 12", 12,
18 '"use if" with a false condition, fake pragma');
19 is( eval "use if ($v_minus > \$]), strict => 'refs'; \${'f'} = 12", 12,
20 '"use if" with a false condition and a pragma');
22 is( eval "use if ($v_plus > \$]), strict => 'subs'; \${'f'} = 12", 12,
23 '"use if" with a true condition, fake pragma');
25 is( eval "use if ($v_plus > \$]), strict => 'refs'; \${'f'} = 12", undef,
26 '"use if" with a true condition and a pragma');
27 like( $@, qr/while "strict refs" in use/, 'expected error message'),
29 # Old version had problems with the module name 'open', which is a keyword too
30 # Use 'open' =>, since pre-5.6.0 could interpret differently
31 is( (eval "use if ($v_plus > \$]), 'open' => IN => ':crlf'; 12" || 0), 12,
32 '"use if" with open');
34 is(eval "use if ($v_plus > \$])", undef,
35 "Too few args to 'use if' returns <undef>");
36 like($@, qr/Too few arguments to 'use if'/, " ... and returns correct error");
38 is(eval "no if ($v_plus > \$])", undef,
39 "Too few args to 'no if' returns <undef>");
40 like($@, qr/Too few arguments to 'no if'/, " ... and returns correct error");