3 # Tests the scoping of $^H and %^H
5 BEGIN { print "1..14\n"; }
7 print "not " if exists $^H{foo};
8 print "ok 1 - \$^H{foo} doesn't exist initially\n";
9 print "not " if $^H & 0x00020000;
10 print "ok 2 - \$^H doesn't contain HINT_LOCALIZE_HH initially\n";
13 # simulate a pragma -- don't forget HINT_LOCALIZE_HH
14 BEGIN { $^H |= 0x00020000; $^H{foo} = "a"; }
16 print "not " if $^H{foo} ne "a";
17 print "ok 3 - \$^H{foo} is now 'a'\n";
18 print "not " unless $^H & 0x00020000;
19 print "ok 4 - \$^H contains HINT_LOCALIZE_HH while compiling\n";
22 BEGIN { $^H |= 0x00020000; $^H{foo} = "b"; }
24 print "not " if $^H{foo} ne "b";
25 print "ok 5 - \$^H{foo} is now 'b'\n";
29 print "not " if $^H{foo} ne "a";
30 print "ok 6 - \$H^{foo} restored to 'a'\n";
32 # The pragma settings disappear after compilation
33 # (test at CHECK-time and at run-time)
35 print "not " if exists $^H{foo};
36 print "ok 9 - \$^H{foo} doesn't exist when compilation complete\n";
37 print "not " if $^H & 0x00020000;
38 print "ok 10 - \$^H doesn't contain HINT_LOCALIZE_HH when compilation complete\n";
40 print "not " if exists $^H{foo};
41 print "ok 11 - \$^H{foo} doesn't exist at runtime\n";
42 print "not " if $^H & 0x00020000;
43 print "ok 12 - \$^H doesn't contain HINT_LOCALIZE_HH at run-time\n";
44 # op_entereval should keep the pragmas it was compiled with
46 print "not " if $^H{foo} ne "a";
47 print "ok 13 - \$^H{foo} is 'a' at eval-\"\" time # TODO\n";
48 print "not " unless $^H & 0x00020000;
49 print "ok 14 - \$^H contains HINT_LOCALIZE_HH at eval\"\"-time\n";
53 print "not " if exists $^H{foo};
54 print "ok 7 - \$^H{foo} doesn't exist while finishing compilation\n";
55 print "not " if $^H & 0x00020000;
56 print "ok 8 - \$^H doesn't contain HINT_LOCALIZE_HH while finishing compilation\n";