6 use Test::More tests => 29 + 13 * 2;
8 use Scope::Upper qw/:words/;
10 is HERE, 0, 'main : here';
11 is TOP, 0, 'main : top';
12 is UP, 0, 'main : up';
13 is SUB, undef, 'main : sub';
14 is EVAL, undef, 'main : eval';
17 is HERE, 1, '{ 1 } : here';
18 is TOP, 0, '{ 1 } : top';
19 is UP, 0, '{ 1 } : up';
23 is HERE, 1, 'do { 1 } : here';
24 is SUB, undef, 'do { 1 } : sub';
25 is EVAL, undef, 'do { 1 } : eval';
29 is HERE, 1, 'eval { 1 } : here';
30 is SUB, undef, 'eval { 1 } : sub';
31 is EVAL, 1, 'eval { 1 } : eval';
35 is HERE, 1, 'eval "1" : here';
36 is SUB, undef, 'eval "1" : sub';
37 is EVAL, 1, 'eval "1" : eval';
41 is HERE, 1, 'do { 1 } while (0) : here';
45 is HERE, 1, 'sub { 1 } : here';
46 is SUB, 1, 'sub { 1 } : sub';
47 is EVAL, undef, 'sub { 1 } : eval';
51 is HERE, 1, 'for () { 1 } : here';
60 is HERE, 6, 'mixed : here';
61 is TOP, 0, 'mixed : top';
62 is SUB, 4, 'mixed : first sub';
63 is SUB(SUB), 4, 'mixed : still first sub';
64 is EVAL, 5, 'mixed : first eval';
65 is EVAL(EVAL), 5, 'mixed : still first eval';
66 is EVAL(UP(EVAL)), 2, 'mixed : second eval';
75 is SCOPE, 1, 'block : scope';
76 is SCOPE(0), 1, 'block : scope 0';
77 is SCOPE(1), 0, 'block : scope 1';
78 is CALLER, 0, 'block: caller';
79 is CALLER(0), 0, 'block : caller 0';
80 is CALLER(1), 0, 'block : caller 1';
82 is SCOPE, 2, 'block sub : scope';
83 is SCOPE(0), 2, 'block sub : scope 0';
84 is SCOPE(1), 1, 'block sub : scope 1';
85 is CALLER, 2, 'block sub : caller';
86 is CALLER(0), 2, 'block sub : caller 0';
87 is CALLER(1), 0, 'block sub : caller 1';
89 is SCOPE, 3, 'block sub for : scope';
90 is SCOPE(0), 3, 'block sub for : scope 0';
91 is SCOPE(1), 2, 'block sub for : scope 1';
92 is CALLER, 2, 'block sub for : caller';
93 is CALLER(0), 2, 'block sub for : caller 0';
94 is CALLER(1), 0, 'block sub for : caller 1';
96 is SCOPE, 4, 'block sub for eval : scope';
97 is SCOPE(0), 4, 'block sub for eval : scope 0';
98 is SCOPE(1), 3, 'block sub for eval : scope 1';
99 is SCOPE(2), 2, 'block sub for eval : scope 2';
100 is CALLER, 4, 'block sub for eval : caller';
101 is CALLER(0), 4, 'block sub for eval : caller 0';
102 is CALLER(1), 2, 'block sub for eval : caller 1';
103 is CALLER(2), 0, 'block sub for eval : caller 2';