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<cast dispell MGf_COPY VMG_UVAR>;
+use Variable::Magic qw<cast dispell VMG_UVAR>;
use lib 't/lib';
use Variable::Magic::TestWatcher;
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<a b d>; }
- +{ (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';
SKIP: {
my $SKIP;
- unless (VMG_UVAR) {
+ if (!VMG_UVAR) {
$SKIP = 'uvar magic';
} else {
- eval "use B::Deparse";
- $SKIP = 'B::Deparse' if $@;
+ local $@;
+ unless (eval { require B::Deparse; 1 }) {
+ $SKIP = 'B::Deparse';
+ }
}
if ($SKIP) {
$SKIP .= ' required to test uvar/clear interaction fix';