+# Hash element
+
+my %h = (a => 7, b => 8);
+
+watch { cast $h{b}, $wiz } { }, 'hash element: cast';
+
+watch { $h{b} = 6 } { set => 1 }, 'hash element: set';
+
+$b = watch { $h{b} } { get => ($is_5130_release ? 2 : 1) }, 'hash element: get';
+is $b, 6, 'scalar: hash element: get correctly';
+
+watch { $h{a} = 5 } { }, 'hash element: set other';
+
+$b = watch { $h{a} } { }, 'hash element: get other';
+is $b, 5, 'scalar: hash element: get other correctly';
+
+$b = watch { exists $h{b} } { }, 'hash element: exists';
+is $b, 1, 'scalar: hash element: exists correctly';
+
+$b = watch { delete $h{b} } { get => 1, free => 1 }, 'hash element: delete';
+is $b, 6, 'scalar: hash element: delete correctly';
+
+watch { $h{b} = 4 } { }, 'hash element: set after delete';
+
+SKIP: {
+ unless (do { local $@; eval { require Tie::Array; 1 } }) {
+ skip 'Tie::Array required to test clear magic on tied array values' => 5;
+ }
+ defined and diag "Using Tie::Array $_" for $Tie::Array::VERSION;
+
+ tie my @a, 'Tie::StdArray';
+ $a[0] = $$;
+ $a[1] = -$$;
+
+ eval {
+ cast @a, wizard copy => sub { cast $_[3], $wiz; () };
+ };
+ is $@, '', 'cast copy magic on tied array';
+
+ watch { delete $a[0] } [ qw<clear free> ],
+ 'delete from tied array in void context';
+
+ $b = watch { delete $a[1] } [ qw<get clear free> ],
+ 'delete from tied array in scalar context';
+}