10 if (eval "use Symbol qw<gensym>; 1") {
11 plan tests => 2 * 12 + 1;
12 defined and diag "Using Symbol $_" for $Symbol::VERSION;
14 plan skip_all => "Symbol::gensym required for testing magic for globs";
18 use Variable::Magic qw<cast dispell VMG_COMPAT_GLOB_GET>;
20 my %get = VMG_COMPAT_GLOB_GET ? (get => 1) : ();
23 use Variable::Magic::TestWatcher;
25 my $wiz = init_watcher
26 [ qw<get set len clear free copy dup local fetch store exists delete> ],
31 watch { cast *a, $wiz } +{ }, 'cast';
33 watch { local *b = *a } +{ %get }, 'assign to';
35 watch { *a = \1 } +{ %get, set => 1 }, 'assign scalar slot';
36 watch { *a = [ qw<x y> ] } +{ %get, set => 1 }, 'assign array slot';
37 watch { *a = { u => 1 } } +{ %get, set => 1 }, 'assign hash slot';
38 watch { *a = sub { } } +{ %get, set => 1 }, 'assign code slot';
40 watch { *a = gensym() } +{ %get, set => 1 }, 'assign glob';
44 watch { cast *b, $wiz } +{ }, 'cast 2';
47 %get = () if "$]" >= 5.013007;
49 watch { undef *a } +{ %get }, 'undef';
51 watch { dispell *a, $wiz } +{ %get }, 'dispell';