summaryrefslogtreecommitdiff
path: root/t/op/kvaslice.t
diff options
context:
space:
mode:
Diffstat (limited to 't/op/kvaslice.t')
-rw-r--r--t/op/kvaslice.t20
1 files changed, 11 insertions, 9 deletions
diff --git a/t/op/kvaslice.t b/t/op/kvaslice.t
index 16ee4467f2..aec9a97801 100644
--- a/t/op/kvaslice.t
+++ b/t/op/kvaslice.t
@@ -8,7 +8,7 @@ BEGIN {
# use strict;
-plan tests => 40;
+plan tests => 39;
# simple use cases
{
@@ -178,17 +178,19 @@ plan tests => 40;
ok( !exists $a[3], "no autovivification" );
}
-# keys/value/each treat argument as scalar
+# keys/value/each refuse to compile kvaslice
{
my %h = 'a'..'b';
my @i = \%h;
- no warnings 'syntax', 'experimental::autoderef';
- my ($k,$v) = each %i[0];
- is $k, 'a', 'key returned by each %array[ix]';
- is $v, 'b', 'val returned by each %array[ix]';
- %h = 1..10;
- is join('-', sort keys %i[(0)]), '1-3-5-7-9', 'keys %array[ix]';
- is join('-', sort values %i[(0)]), '10-2-4-6-8', 'values %array[ix]';
+ eval '() = keys %i[(0)]';
+ like($@, qr/Experimental keys on scalar is now forbidden/,
+ 'keys %array[ix] forbidden');
+ eval '() = values %i[(0)]';
+ like($@, qr/Experimental values on scalar is now forbidden/,
+ 'values %array[ix] forbidden');
+ eval '() = each %i[(0)]';
+ like($@, qr/Experimental each on scalar is now forbidden/,
+ 'each %array[ix] forbidden');
}
# \% prototype expects hash deref