X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F28-uvar.t;fp=t%2F28-uvar.t;h=65f685b032b79ba88b7e1b33fab39f2fbb02b3fd;hb=da422089a9a5dfbf84e72ec3ba867063471ff41c;hp=fcb531b8d7d691fc24e71dd70cc7dd1a9f36e4e9;hpb=505fda7126b01811c0ca990552876a1c6d9dc7c3;p=perl%2Fmodules%2FVariable-Magic.git diff --git a/t/28-uvar.t b/t/28-uvar.t index fcb531b..65f685b 100644 --- a/t/28-uvar.t +++ b/t/28-uvar.t @@ -16,37 +16,37 @@ if (VMG_UVAR) { use lib 't/lib'; use Variable::Magic::TestWatcher; -my $wiz = init [ qw/fetch store exists delete/ ], 'uvar'; +my $wiz = init_watcher [ qw/fetch store exists delete/ ], 'uvar'; my %h = (a => 1, b => 2, c => 3); -my $res = check { cast %h, $wiz } { }, 'cast'; +my $res = watch { cast %h, $wiz } { }, 'cast'; ok $res, 'uvar: cast succeeded'; -my $x = check { $h{a} } { fetch => 1 }, 'fetch directly'; +my $x = watch { $h{a} } { fetch => 1 }, 'fetch directly'; is $x, 1, 'uvar: fetch directly correctly'; -$x = check { "$h{b}" } { fetch => 1 }, 'fetch by interpolation'; +$x = watch { "$h{b}" } { fetch => 1 }, 'fetch by interpolation'; is $x, 2, 'uvar: fetch by interpolation correctly'; -check { $h{c} = 4 } { store => 1 }, 'store directly'; +watch { $h{c} = 4 } { store => 1 }, 'store directly'; -$x = check { $h{c} = 5 } { store => 1 }, 'fetch and store'; +$x = watch { $h{c} = 5 } { store => 1 }, 'fetch and store'; is $x, 5, 'uvar: fetch and store correctly'; -$x = check { exists $h{c} } { exists => 1 }, 'exists'; +$x = watch { exists $h{c} } { exists => 1 }, 'exists'; ok $x, 'uvar: exists correctly'; -$x = check { delete $h{c} } { delete => 1 }, 'delete existing key'; +$x = watch { delete $h{c} } { delete => 1 }, 'delete existing key'; is $x, 5, 'uvar: delete existing key correctly'; -$x = check { delete $h{z} } { delete => 1 }, 'delete non-existing key'; +$x = watch { delete $h{z} } { delete => 1 }, 'delete non-existing key'; ok !defined $x, 'uvar: delete non-existing key correctly'; my $wiz2 = wizard get => sub { 0 }; cast %h, $wiz2; -$x = check { $h{a} } { fetch => 1 }, 'fetch directly with also non uvar magic'; +$x = watch { $h{a} } { fetch => 1 }, 'fetch directly with also non uvar magic'; is $x, 1, 'uvar: fetch directly with also non uvar magic correctly'; SKIP: { @@ -57,18 +57,18 @@ SKIP: { tie my %h, 'Tie::StdHash'; %h = (x => 7, y => 8); - $res = check { cast %h, $wiz } { }, 'cast on tied hash'; + $res = watch { cast %h, $wiz } { }, 'cast on tied hash'; ok $res, 'uvar: cast on tied hash succeeded'; - $x = check { $h{x} } { fetch => 1 }, 'fetch on tied hash'; + $x = watch { $h{x} } { fetch => 1 }, 'fetch on tied hash'; is $x, 7, 'uvar: fetch on tied hash succeeded'; - check { $h{x} = 9 } { store => 1 }, 'store on tied hash'; + watch { $h{x} = 9 } { store => 1 }, 'store on tied hash'; - $x = check { exists $h{x} } { exists => 1 }, 'exists on tied hash'; + $x = watch { exists $h{x} } { exists => 1 }, 'exists on tied hash'; ok $x, 'uvar: exists on tied hash succeeded'; - $x = check { delete $h{x} } { delete => 1 }, 'delete on tied hash'; + $x = watch { delete $h{x} } { delete => 1 }, 'delete on tied hash'; is $x, 9, 'uvar: delete on tied hash succeeded'; }