In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/178e9024261f3211ad53fe588199fa890a3dbd17?hp=1c424184c97803c765d90531e9cba375ba72f002>
- Log ----------------------------------------------------------------- commit 178e9024261f3211ad53fe588199fa890a3dbd17 Author: Nicholas Clark <[email protected]> Date: Sun Mar 13 17:58:29 2011 +0000 Add a test to ensure that test.pl doesn't mention $& This will allow it to be used safely for tests that explicitly want to test the behaviour of perl without (and with) $& having been seen by the parser. ----------------------------------------------------------------------- Summary of changes: t/porting/test_bootstrap.t | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/t/porting/test_bootstrap.t b/t/porting/test_bootstrap.t index a1bd63d..d07e659 100644 --- a/t/porting/test_bootstrap.t +++ b/t/porting/test_bootstrap.t @@ -45,3 +45,18 @@ while (my $file = <$fh>) { unlike($contents, qr/^\s*require\s+/m, "$file doesn't use require") unless $file eq 'comp/require.t' } + +# There are regression tests using test.pl that don't want PL_sawampersand set + +# This very much relies on a bug in the regexp implementation, but for now it's +# the best way to work out whether PL_sawampersand is true. +# Then again, PL_sawampersand *is* a bug, for precisely the reason that this +# test can detect the behaviour change. + +isnt($INC{'./test.pl'}, undef, 'We loaded test.pl'); +ok("Perl rules" =~ /Perl/, 'Perl rules'); +is(eval '$&', undef, 'Nothing in test.pl mentioned $&'); +is(eval '$`', undef, 'Nothing in test.pl mentioned $`'); +is(eval '$\'', undef, 'Nothing in test.pl mentioned $\''); +# Currently seeing any of the 3 triggers the setting of all 3. +# $` and $' will be '' rather than undef if the regexp sets them. -- Perl5 Master Repository
