diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2002-08-06 19:10:51 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2002-08-06 19:10:51 +0000 |
commit | dbc6b789d967350cc68b3321f366f9441dcf35af (patch) | |
tree | 7408e6997edcec02f7eced6161b326350b36997e /t/comp | |
parent | 7a8ff2dd4a456a3d3ba44383dd89457f1618ec20 (diff) | |
download | perl-dbc6b789d967350cc68b3321f366f9441dcf35af.tar.gz |
More regression tests for $^H and %^H.
Add a TODO test for eval "" preserving %^H.
p4raw-id: //depot/perl@17686
Diffstat (limited to 't/comp')
-rw-r--r-- | t/comp/hints.t | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/t/comp/hints.t b/t/comp/hints.t index 5911b77688..117096860f 100644 --- a/t/comp/hints.t +++ b/t/comp/hints.t @@ -1,36 +1,57 @@ -#!./perl -w +#!./perl -BEGIN { print "1..7\n"; } +# Tests the scoping of $^H and %^H + +BEGIN { print "1..14\n"; } BEGIN { print "not " if exists $^H{foo}; print "ok 1 - \$^H{foo} doesn't exist initially\n"; + print "not " if $^H & 0x00020000; + print "ok 2 - \$^H doesn't contain HINT_LOCALIZE_HH initially\n"; } { # simulate a pragma -- don't forget HINT_LOCALIZE_HH BEGIN { $^H |= 0x00020000; $^H{foo} = "a"; } BEGIN { print "not " if $^H{foo} ne "a"; - print "ok 2 - \$^H{foo} is now 'a'\n"; + print "ok 3 - \$^H{foo} is now 'a'\n"; + print "not " unless $^H & 0x00020000; + print "ok 4 - \$^H contains HINT_LOCALIZE_HH while compiling\n"; } { BEGIN { $^H |= 0x00020000; $^H{foo} = "b"; } BEGIN { print "not " if $^H{foo} ne "b"; - print "ok 3 - \$^H{foo} is now 'b'\n"; + print "ok 5 - \$^H{foo} is now 'b'\n"; } } BEGIN { print "not " if $^H{foo} ne "a"; - print "ok 4 - \$H^{foo} restored to 'a'\n"; + print "ok 6 - \$H^{foo} restored to 'a'\n"; } + # The pragma settings disappear after compilation + # (test at CHECK-time and at run-time) CHECK { print "not " if exists $^H{foo}; - print "ok 6 - \$^H{foo} doesn't exist when compilation complete\n"; + print "ok 9 - \$^H{foo} doesn't exist when compilation complete\n"; + print "not " if $^H & 0x00020000; + print "ok 10 - \$^H doesn't contain HINT_LOCALIZE_HH when compilation complete\n"; } print "not " if exists $^H{foo}; - print "ok 7 - \$^H{foo} doesn't exist at runtime\n"; + print "ok 11 - \$^H{foo} doesn't exist at runtime\n"; + print "not " if $^H & 0x00020000; + print "ok 12 - \$^H doesn't contain HINT_LOCALIZE_HH at run-time\n"; + # op_entereval should keep the pragmas it was compiled with + eval q* + print "not " if $^H{foo} ne "a"; + print "ok 13 - \$^H{foo} is 'a' at eval-\"\" time # TODO\n"; + print "not " unless $^H & 0x00020000; + print "ok 14 - \$^H contains HINT_LOCALIZE_HH at eval\"\"-time\n"; + *; } BEGIN { print "not " if exists $^H{foo}; - print "ok 5 - \$^H{foo} doesn't exist while finishing compilation\n"; + print "ok 7 - \$^H{foo} doesn't exist while finishing compilation\n"; + print "not " if $^H & 0x00020000; + print "ok 8 - \$^H doesn't contain HINT_LOCALIZE_HH while finishing compilation\n"; } |