X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;ds=sidebyside;f=t%2F32-hash.t;h=5cc5e1f2a6ad4ce9c322344c7cd26646176d01f1;hb=b34eec5b227be170f3cf8efdb8aaae400370960b;hp=c1e0831229813ecb303f7b97506745a9c073f22e;hpb=e7d06d42b01cc371aabcd4cee7ef786059ed7a1b;p=perl%2Fmodules%2FVariable-Magic.git diff --git a/t/32-hash.t b/t/32-hash.t index c1e0831..5cc5e1f 100644 --- a/t/32-hash.t +++ b/t/32-hash.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => (2 * 21 + 7) + (2 * 5 + 5) + 1; +use Test::More tests => (2 * 22 + 7) + (2 * 5 + 5) + 1; use Variable::Magic qw; @@ -40,18 +40,22 @@ is_deeply \@b, [ @n{qw} ], 'hash: slice correctly'; watch { %h = () } { clear => 1 }, 'empty in list context'; -watch { %h = (a => 1, d => 3); () } +watch { %h = (a => 1, d => 3) } +{ (store => 2, copy => 2) x VMG_UVAR, clear => 1 }, 'assign from list in void context'; +@b = watch { %h = (a => 1, d => 3) } + +{ (exists => 2, store => 2, copy => 2) x VMG_UVAR, clear => 1 }, + 'assign from list in void context'; + watch { %h = map { $_ => 1 } qw; } - +{ (exists => 3, store => 3, copy => 3) x VMG_UVAR, clear => 1 }, - 'assign from map in list context'; + +{ (store => 3, copy => 3) x VMG_UVAR, clear => 1 }, + 'assign from map in void context'; -watch { $h{d} = 2; () } +{ (store => 1) x VMG_UVAR }, +watch { $h{d} = 2 } +{ (store => 1) x VMG_UVAR }, 'assign old element'; -watch { $h{c} = 3; () } +{ (store => 1, copy => 1) x VMG_UVAR }, +watch { $h{c} = 3 } +{ (store => 1, copy => 1) x VMG_UVAR }, 'assign new element'; $s = watch { %h } { }, 'buckets';