8 use Variable::Magic qw/wizard cast dispell VMG_UVAR VMG_OP_INFO_NAME VMG_OP_INFO_OBJECT/;
15 plan skip_all => 'uvar magic is required to test symbol table hooks';
21 . join (', ', map { <<CB;
24 return 0 if \$d->{guard};
25 local \$d->{guard} = 1;
26 push \@{\$mg{$_}}, \$_[2];
30 } qw/fetch store exists delete/);
32 $code .= ', data => sub { +{ guard => 0 } }';
39 cast %{"Hlagh::"}, $wiz;
55 is $@, "ok\n", 'stash: variables compiled fine';
59 }, 'stash: variables';
73 is $@, "ok\n", 'stash: function calls compiled fine';
75 fetch => [ qw/foo bar foo/ ],
76 store => [ qw/foo bar foo/ ],
77 }, 'stash: function calls';
88 is $@, '', 'stash: delete executed fine';
90 store => [ qw/foo foo foo/ ],
95 is_deeply \%mg, { }, 'stash: magic that remains at END time' if $run;
100 dispell %{"Hlagh::"}, $wiz;
104 . join (', ', map { <<CB;
107 return 0 if \$d->{guard};
108 local \$d->{guard} = 1;
109 is \$_[3], undef, 'stash: undef op';
113 } qw/fetch store exists delete/);
115 $code .= ', data => sub { +{ guard => 0 } }';
117 $wiz = eval $code . ', op_info => ' . VMG_OP_INFO_NAME;
122 cast %{"Hlagh::"}, $wiz;
131 is $@, "ok\n", 'stash: function call with op name compiled fine';
135 dispell %{"Hlagh::"}, $wiz;
138 $wiz = eval $code . ', op_info => ' . VMG_OP_INFO_OBJECT;
143 cast %{"Hlagh::"}, $wiz;
152 is $@, "ok\n", 'stash: function call with op object compiled fine';
156 dispell %{"Hlagh::"}, $wiz;