diff options
Diffstat (limited to 't/op/magic.t')
-rw-r--r-- | t/op/magic.t | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/t/op/magic.t b/t/op/magic.t index 6951850e0f..6701cf77cf 100644 --- a/t/op/magic.t +++ b/t/op/magic.t @@ -12,7 +12,7 @@ BEGIN { use warnings; use Config; -plan (tests => 83); +plan (tests => 87); $Is_MSWin32 = $^O eq 'MSWin32'; $Is_NetWare = $^O eq 'NetWare'; @@ -445,6 +445,25 @@ SKIP: { ok ${"!"}{ENOENT}; } +# Check that we don't auto-load packages +foreach (['powie::!', 'Errno'], + ['powie::+', 'Tie::Hash::NamedCapture']) { + my ($symbol, $package) = @$_; + foreach my $scalar_first ('', '$$symbol;') { + my $desc = qq{Referencing %{"$symbol"}}; + $desc .= qq{ after mentioning \${"$symbol"}} if $scalar_first; + $desc .= " doesn't load $package"; + + fresh_perl_is(<<"EOP", 0, {}, $desc); +use strict qw(vars subs); +my \$symbol = '$symbol'; +$scalar_first; +1 if %{\$symbol}; +print scalar %${package}::; +EOP + } +} + is $^S, 0; eval { is $^S,1 }; eval " BEGIN { ok ! defined \$^S } "; |