]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blobdiff - t/22-len.t
Test when magic actions take place
[perl/modules/Variable-Magic.git] / t / 22-len.t
index 3b8039efc1f926af430c4c5da0eda14235d5aa19..7025e7bb1ffce743f0d70f5a83aef9a72dec3cac 100644 (file)
@@ -3,9 +3,12 @@
 use strict;
 use warnings;
 
-use Test::More tests => 33;
+use Test::More tests => 33 + (2 * 2 + 1);
 
-use Variable::Magic qw/wizard cast VMG_COMPAT_SCALAR_LENGTH_NOLEN/;
+use Variable::Magic qw/wizard cast dispell VMG_COMPAT_SCALAR_LENGTH_NOLEN/;
+
+use lib 't/lib';
+use Variable::Magic::TestValue;
 
 my $c = 0;
 
@@ -124,3 +127,14 @@ SKIP: {
  is $d, 5,  'len: get utf8 scalar length have correct default length';
  is $b, $d, 'len: get utf8 scalar length correctly';
 }
+
+{
+ my @val = (4 .. 6);
+
+ my $wv = init_value @val, 'len', 'len';
+
+ value { $val[-1] = 8 } [ 4, 5, 6 ];
+
+ dispell @val, $wv;
+ is_deeply \@val, [ 4, 5, 8 ], 'len: after value';
+}