blob: 12ad0b0c390d7e74a242fa1cd07bbc231a5ca2cd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#!./perl
BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
}
use Test::More tests => 4;
my $v_plus = $] + 1;
my $v_minus = $] - 1;
ok( eval "use if ($v_minus > \$]), strict => 'subs'; \${'f'} = 12" eq 12,
'"use if" with a false condition, fake pragma');
ok( eval "use if ($v_minus > \$]), strict => 'refs'; \${'f'} = 12" eq 12,
'"use if" with a false condition and a pragma');
ok( eval "use if ($v_plus > \$]), strict => 'subs'; \${'f'} = 12" eq 12,
'"use if" with a true condition, fake pragma');
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');
|