The real fix for RT#73402 (abaondon tie %^H entirely), FC++
[p5sagit/namespace-clean.git] / t / 09-fiddle-hinthash.t
1 use strict;
2 use warnings;
3
4 use Test::More 0.88;
5
6 {
7   package Bar;
8   use sort 'stable';
9   use namespace::clean;
10   use sort 'stable';
11   {
12     1;
13   }
14
15   Test::More::pass('no segfault');
16 }
17
18 {
19   package Foo;
20   BEGIN {
21     $^H{'foo'} = 'bar';
22   }
23
24   use namespace::clean;
25
26   BEGIN {
27     Test::More::is( $^H{'foo'}, 'bar', 'compiletime hinthash intact after n::c' );
28   }
29
30   {
31     BEGIN {
32       Test::More::is(
33         $^H{'foo'}, 'bar', 'compile-time hinthash intact in inner scope'
34       );
35     }
36     1;
37   }
38
39   BEGIN {
40     SKIP: {
41       Test::More::skip(
42         'Tied hinthash values not present in extended caller() on perls older than 5.10'
43        .', regardless of mode (PP or XS)',
44         1
45       ) if ($] < 5.010_000);
46       package DB;
47       Test::More::is( ( (caller(0))[10] || {} )->{foo}, 'bar', 'hinthash values visible in caller' );
48     }
49   }
50 }
51
52
53 done_testing;