]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blob - t/34-glob.t
Rename test functions init() and check() to init_watcher() and watch()
[perl/modules/Variable-Magic.git] / t / 34-glob.t
1 #!perl -T
2
3 use strict;
4 use warnings;
5
6 use Test::More;
7
8 eval "use Symbol qw/gensym/";
9 if ($@) {
10  plan skip_all => "Symbol::gensym required for testing magic for globs";
11 } else {
12  plan tests => 2 * 8 + 1;
13  diag "Using Symbol $Symbol::VERSION" if defined $Symbol::VERSION;
14 }
15
16 use Variable::Magic qw/cast dispell/;
17
18 use lib 't/lib';
19 use Variable::Magic::TestWatcher;
20
21 my $wiz = init_watcher
22         [ qw/get set len clear free copy dup local fetch store exists delete/ ],
23         'glob';
24
25 local *a = gensym();
26
27 watch { cast *a, $wiz } { }, 'cast';
28
29 watch { local *b = *a } { }, 'assign to';
30
31 watch { *a = gensym() } { set => 1 }, 'assign';
32
33 watch {
34  local *b = gensym();
35  watch { cast *b, $wiz } { }, 'cast 2';
36 } { }, 'scope end';
37
38 watch { undef *a } { }, 'undef';
39
40 watch { dispell *a, $wiz } { }, 'dispell';