From: Vincent Pit Date: Sat, 23 May 2009 22:26:55 +0000 (+0200) Subject: Add a TODO test for the "pragma propagating into require" issue X-Git-Tag: v0.13~6 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2Findirect.git;a=commitdiff_plain;h=3b0a87b6115bb15525313ea0dc3def689d2fb2e8 Add a TODO test for the "pragma propagating into require" issue --- diff --git a/MANIFEST b/MANIFEST index b97c86d..183e407 100644 --- a/MANIFEST +++ b/MANIFEST @@ -18,3 +18,4 @@ t/91-pod.t t/92-pod-coverage.t t/95-portability-files.t t/99-kwalitee.t +t/lib/indirect/TestRequired.pm diff --git a/t/30-scope.t b/t/30-scope.t index e9ab480..8eb7ecc 100644 --- a/t/30-scope.t +++ b/t/30-scope.t @@ -6,7 +6,9 @@ use warnings; my $tests; BEGIN { $tests = 18 } -use Test::More tests => 1 + $tests + 1 + 2; +use Test::More tests => 1 + $tests + 1 + 2 + 2; + +use lib 't/lib'; my %wrong = map { $_ => 1 } 2, 3, 5, 7, 9, 10, 14, 15, 17, 18; @@ -67,6 +69,17 @@ sub expect { } } +{ + local $TODO = 'Need a workaround for this' if $] < 5.010001; + my @w; + { + local $SIG{__WARN__} = sub { push @w, join '', @_ }; + eval 'no indirect; use indirect::TestRequired'; + } + is $@, '', 'require test didn\'t croak'; + is_deeply \@w, [ ], 'pragma didn\'t propagate into the required file'; +} + __DATA__ my $a = new P1; diff --git a/t/lib/indirect/TestRequired.pm b/t/lib/indirect/TestRequired.pm new file mode 100644 index 0000000..c27d144 --- /dev/null +++ b/t/lib/indirect/TestRequired.pm @@ -0,0 +1,9 @@ +package indirect::TestRequired; + +BEGIN { require strict; } + +import strict; + +eval 'import strict;'; + +1;