X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F34-glob.t;h=bbfbeeedff7ffb4de870d1910e7006857a4b6598;hb=159e8ad7c747edb4a25db2f2673bbe143531f347;hp=de5c64cdf16ed408e3be995775656dfbf860f9e8;hpb=d40ee99380faf573a5d2983fbd730600266244e7;p=perl%2Fmodules%2FVariable-Magic.git diff --git a/t/34-glob.t b/t/34-glob.t index de5c64c..bbfbeee 100644 --- a/t/34-glob.t +++ b/t/34-glob.t @@ -9,8 +9,8 @@ eval "use Symbol qw/gensym/"; if ($@) { plan skip_all => "Symbol::gensym required for testing magic for globs"; } else { - plan tests => 2 * 8 + 1; - diag "Using Symbol $Symbol::VERSION" if defined $Symbol::VERSION; + plan tests => 2 * 12 + 1; + defined and diag "Using Symbol $_" for $Symbol::VERSION; } use Variable::Magic qw/cast dispell VMG_COMPAT_GLOB_GET/; @@ -30,13 +30,20 @@ watch { cast *a, $wiz } +{ }, 'cast'; watch { local *b = *a } +{ %get }, 'assign to'; -watch { *a = gensym() } +{ %get, set => 1 }, 'assign'; +watch { *a = \1 } +{ %get, set => 1 }, 'assign scalar slot'; +watch { *a = [ qw/x y/ ] } +{ %get, set => 1 }, 'assign array slot'; +watch { *a = { u => 1 } } +{ %get, set => 1 }, 'assign hash slot'; +watch { *a = sub { } } +{ %get, set => 1 }, 'assign code slot'; + +watch { *a = gensym() } +{ %get, set => 1 }, 'assign glob'; watch { local *b = gensym(); watch { cast *b, $wiz } +{ }, 'cast 2'; } +{ }, 'scope end'; +%get = () if $] >= 5.013007; + watch { undef *a } +{ %get }, 'undef'; watch { dispell *a, $wiz } +{ %get }, 'dispell';