The tokenizer should expect an operator after qw().
[p5sagit/p5-mst-13.2.git] / t / op / list.t
index a4230b6..89ccf02 100755 (executable)
@@ -1,8 +1,6 @@
 #!./perl
 
-# $RCSfile: list.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:02 $
-
-print "1..27\n";
+print "1..30\n";
 
 @foo = (1, 2, 3, 4);
 if ($foo[0] == 1 && $foo[3] == 4) {print "ok 1\n";} else {print "not ok 1\n";}
@@ -81,3 +79,20 @@ for ($x = 0; $x < 3; $x++) {
     print $a,$b,$c;
 }
 
+# slices
+{
+    my @a = (0, undef, undef, 3);
+    my @b = @a[1,2];
+    my @c = (0, undef, undef, 3)[1, 2];
+    print "not " unless @b == @c and @c == 2;
+    print "ok 28\n";
+
+    @b = (29, scalar @c[()]);
+    print "not " if join(':',@b) ne '29:';
+    print "ok 29\n";
+
+    my %h = (a => 1);
+    @b = (30, scalar @h{()});
+    print "not " if join(':',@b) ne '30:';
+    print "ok 30\n";
+}