X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F40-scope.t;h=0e3cdecfa5f88da56329f07d3088f4579fd193b1;hb=d98155fce615007c0caae395a82ebd178d4b3877;hp=857a7809ce1bf7480ecd627f62624e4a94476e72;hpb=40b9bfe1115b33d2d5f88d57f983c2ddd7d3f5d2;p=perl%2Fmodules%2Fautovivification.git diff --git a/t/40-scope.t b/t/40-scope.t index 857a780..0e3cdec 100644 --- a/t/40-scope.t +++ b/t/40-scope.t @@ -1,9 +1,9 @@ -#!perl -T +#!perl use strict; use warnings; -use Test::More tests => 8; +use Test::More tests => 12; use lib 't/lib'; @@ -41,3 +41,31 @@ our $blurp; $expect->{r2_eval} = { } if $] < 5.009005; is_deeply $blurp, $expect, 'second require test didn\'t vivify'; } + +# This test may not fail for the old version when ran in taint mode +{ + my $err = eval <<' SNIP'; + use autovivification::TestRequired4::a0; + autovivification::TestRequired4::a0::error(); + SNIP + is $err, '', 'RT #50570'; +} + +# This test must be in the topmost scope +BEGIN { eval 'use autovivification::TestRequired5::a0' } +my $err = autovivification::TestRequired5::a0::error(); +is $err, '', 'identifying requires by their eval context pointer is not enough'; + +{ + local $blurp; + + no autovivification; + use autovivification::TestRequired6; + + autovivification::TestRequired6::bar(); + is_deeply $blurp, { }, 'vivified without eval'; + + $blurp = undef; + autovivification::TestRequired6::baz(); + is_deeply $blurp, { }, 'vivified with eval'; +}