6 use Test::More tests => 3 + 6 + 4 + 1 + 5;
8 use Scope::Upper qw<uid HERE UP>;
15 is $@, '', 'uid() does not croak';
23 is $@, '', 'uid(HERE) does not croak';
31 is $@, '', 'uid(UP) does not croak';
36 is $here, uid(), '$here eq uid()';
37 is $here, uid(HERE), '$here eq uid(HERE)';
39 is $here, uid(UP), '$here eq uid(UP) (in block)';
42 is $here, uid(UP), '$here eq uid(UP) (in sub)';
46 is $here, uid(UP), '$here eq uid(UP) (in eval block)';
49 is $here, uid(UP), '$here eq uid(UP) (in eval string)';
58 isnt $here, uid(), 'uid(UP) != uid(HERE)';
60 is $here, uid(), '$here defined in an older block is now OK';
62 isnt $here, uid(), '$here defined in an older block is no longer OK';
64 isnt $here, uid(), '$here defined in an older block has been overwritten';
74 isnt $first, uid(), 'a new UID for each loop iteration';
83 sub Scope::Upper::TestUIDDestructor::DESTROY {
85 isnt $uid, $top, '$uid is not the outside UID';
87 is uid(UP), $uid, 'uid(UP) in block in destructor is correct';
92 my $guard = bless [], 'Scope::Upper::TestUIDDestructor';
95 isnt $uid, undef, '$uid was set in the destructor';
98 isnt $uid, uid(), '$uid is no longer valid (in block)';
100 isnt $uid, uid(), '$uid is no longer valid (in sub in block)';