diff options
Diffstat (limited to 't/op.range')
-rw-r--r-- | t/op.range | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/t/op.range b/t/op.range new file mode 100644 index 0000000000..4975c44441 --- /dev/null +++ b/t/op.range @@ -0,0 +1,30 @@ +#!./perl + +# $Header: op.range,v 3.0 89/10/18 15:30:53 lwall Locked $ + +print "1..6\n"; + +print join(':',1..5) eq '1:2:3:4:5' ? "ok 1\n" : "not ok 1\n"; + +@foo = (1,2,3,4,5,6,7,8,9); +@foo[2..4] = ('c','d','e'); + +print join(':',@foo[$foo[0]..5]) eq '2:c:d:e:6' ? "ok 2\n" : "not ok 2\n"; + +@bar[2..4] = ('c','d','e'); +print join(':',@bar[1..5]) eq ':c:d:e:' ? "ok 3\n" : "not ok 3\n"; + +($a,@bcd[0..2],$e) = ('a','b','c','d','e'); +print join(':',$a,@bcd[0..2],$e) eq 'a:b:c:d:e' ? "ok 4\n" : "not ok 4\n"; + +$x = 0; +for (1..100) { + $x += $_; +} +print $x == 5050 ? "ok 5\n" : "not ok 5 $x\n"; + +$x = 0; +for ((100,2..99,1)) { + $x += $_; +} +print $x == 5050 ? "ok 6\n" : "not ok 6 $x\n"; |