12 load_or_skip_all('Symbol', undef, [ 'gensym' ]);
13 plan tests => 2 * 17 + 1;
16 use Variable::Magic qw<cast dispell VMG_COMPAT_GLOB_GET>;
18 my %get = VMG_COMPAT_GLOB_GET ? (get => 1) : ();
21 use Variable::Magic::TestWatcher;
23 my $wiz = init_watcher
24 [ qw<get set len clear free copy dup local fetch store exists delete> ],
29 watch { cast *a, $wiz } +{ }, 'cast';
31 watch { local *b = *a } +{ %get }, 'assign to';
34 skip 'This failed temporarily between perls 5.13.1 and 5.13.8 (included)'
35 => 5 * 2 if "$]" >= 5.013_001 and "$]" <= 5.013_008;
37 my $cxt = 'void contex';
38 my $exp = { set => 1 };
40 watch { *a = \1 } $exp, "assign scalar slot in $cxt";
41 watch { *a = [ qw<x y> ] } $exp, "assign array slot in $cxt";
42 watch { *a = { u => 1 } } $exp, "assign hash slot in $cxt";
43 watch { *a = sub { } } $exp, "assign code slot in $cxt";
44 watch { *a = gensym() } $exp, "assign glob in $cxt";
48 my $cxt = 'scalar context';
49 my $exp = { %get, set => 1 };
52 $v = watch { *a = \1 } $exp, "assign scalar slot in $cxt";
53 $v = watch { *a = [ qw<x y> ] } $exp, "assign array slot in $cxt";
54 $v = watch { *a = { u => 1 } } $exp, "assign hash slot in $cxt";
55 $v = watch { *a = sub { } } $exp, "assign code slot in $cxt";
56 $v = watch { *a = gensym() } $exp, "assign glob in $cxt";
61 watch { cast *b, $wiz } +{ }, 'cast 2';
64 %get = () if "$]" >= 5.013_007;
66 watch { undef *a } +{ %get }, 'undef';
68 watch { dispell *a, $wiz } +{ %get }, 'dispell';