6 use Test::More tests => 29 + 13 * 2;
8 use Scope::Upper qw/:words/;
10 # This test is for internal use only and doesn't imply any kind of future
11 # compatibility on what the words should actually return.
12 # It is expected to fail when ran under the debugger.
14 is HERE, 0, 'main : here';
15 is TOP, 0, 'main : top';
16 is UP, 0, 'main : up';
17 is SUB, undef, 'main : sub';
18 is EVAL, undef, 'main : eval';
21 is HERE, 1, '{ 1 } : here';
22 is TOP, 0, '{ 1 } : top';
23 is UP, 0, '{ 1 } : up';
27 is HERE, 1, 'do { 1 } : here';
28 is SUB, undef, 'do { 1 } : sub';
29 is EVAL, undef, 'do { 1 } : eval';
33 is HERE, 1, 'eval { 1 } : here';
34 is SUB, undef, 'eval { 1 } : sub';
35 is EVAL, 1, 'eval { 1 } : eval';
39 is HERE, 1, 'eval "1" : here';
40 is SUB, undef, 'eval "1" : sub';
41 is EVAL, 1, 'eval "1" : eval';
45 is HERE, 1, 'do { 1 } while (0) : here';
49 is HERE, 1, 'sub { 1 } : here';
50 is SUB, 1, 'sub { 1 } : sub';
51 is EVAL, undef, 'sub { 1 } : eval';
55 is HERE, 1, 'for () { 1 } : here';
64 is HERE, 6, 'mixed : here';
65 is TOP, 0, 'mixed : top';
66 is SUB, 4, 'mixed : first sub';
67 is SUB(SUB), 4, 'mixed : still first sub';
68 is EVAL, 5, 'mixed : first eval';
69 is EVAL(EVAL), 5, 'mixed : still first eval';
70 is EVAL(UP(EVAL)), 2, 'mixed : second eval';
79 is SCOPE, 1, 'block : scope';
80 is SCOPE(0), 1, 'block : scope 0';
81 is SCOPE(1), 0, 'block : scope 1';
82 is CALLER, 0, 'block: caller';
83 is CALLER(0), 0, 'block : caller 0';
84 is CALLER(1), 0, 'block : caller 1';
86 is SCOPE, 2, 'block sub : scope';
87 is SCOPE(0), 2, 'block sub : scope 0';
88 is SCOPE(1), 1, 'block sub : scope 1';
89 is CALLER, 2, 'block sub : caller';
90 is CALLER(0), 2, 'block sub : caller 0';
91 is CALLER(1), 0, 'block sub : caller 1';
93 is SCOPE, 3, 'block sub for : scope';
94 is SCOPE(0), 3, 'block sub for : scope 0';
95 is SCOPE(1), 2, 'block sub for : scope 1';
96 is CALLER, 2, 'block sub for : caller';
97 is CALLER(0), 2, 'block sub for : caller 0';
98 is CALLER(1), 0, 'block sub for : caller 1';
100 is SCOPE, 4, 'block sub for eval : scope';
101 is SCOPE(0), 4, 'block sub for eval : scope 0';
102 is SCOPE(1), 3, 'block sub for eval : scope 1';
103 is SCOPE(2), 2, 'block sub for eval : scope 2';
104 is CALLER, 4, 'block sub for eval : caller';
105 is CALLER(0), 4, 'block sub for eval : caller 0';
106 is CALLER(1), 2, 'block sub for eval : caller 1';
107 is CALLER(2), 0, 'block sub for eval : caller 2';