diff options
author | Larry Wall <lwall@jpl-devvax.jpl.nasa.gov> | 1990-03-12 04:13:22 +0000 |
---|---|---|
committer | Larry Wall <lwall@jpl-devvax.jpl.nasa.gov> | 1990-03-12 04:13:22 +0000 |
commit | 79a0689e17f959bdb246dc37bbbbfeba4c2b3b56 (patch) | |
tree | 9d9d5ae4fd6a3bc9c009a7aebe90073c900a27a7 /t | |
parent | ff2452de34aca0717369277df00e15764613e5c1 (diff) | |
download | perl-79a0689e17f959bdb246dc37bbbbfeba4c2b3b56.tar.gz |
perl 3.0 patch #14 patch #13, continued
See patch #13.
Diffstat (limited to 't')
-rw-r--r-- | t/op.array | 24 | ||||
-rw-r--r-- | t/op.mkdir | 6 | ||||
-rw-r--r-- | t/op.push | 37 |
3 files changed, 60 insertions, 7 deletions
diff --git a/t/op.array b/t/op.array index ebfb5e8a4b..7129ee3e1d 100644 --- a/t/op.array +++ b/t/op.array @@ -1,8 +1,8 @@ #!./perl -# $Header: op.array,v 3.0 89/10/18 15:26:55 lwall Locked $ +# $Header: op.array,v 3.0.1.1 90/03/12 17:03:03 lwall Locked $ -print "1..30\n"; +print "1..36\n"; @ary = (1,2,3,4,5); if (join('',@ary) eq '12345') {print "ok 1\n";} else {print "not ok 1\n";} @@ -98,3 +98,23 @@ print join(' ',@foo) eq 'the time men come' ? "ok 29\n" : "not ok 29\n"; @foo = grep(!/e/,split(' ','now is the time for all good men to come to')); print join(' ',@foo) eq 'now is for all good to to' ? "ok 30\n" : "not ok 30\n"; + +$foo = join('',('a','b','c','d','e','f')[0..5]); +print $foo eq 'abcdef' ? "ok 31\n" : "not ok 31\n"; + +$foo = join('',('a','b','c','d','e','f')[0..1]); +print $foo eq 'ab' ? "ok 32\n" : "not ok 32\n"; + +$foo = join('',('a','b','c','d','e','f')[6]); +print $foo eq '' ? "ok 33\n" : "not ok 33\n"; + +@foo = ('a','b','c','d','e','f')[0,2,4]; +@bar = ('a','b','c','d','e','f')[1,3,5]; +$foo = join('',(@foo,@bar)[0..5]); +print $foo eq 'acebdf' ? "ok 34\n" : "not ok 34\n"; + +$foo = ('a','b','c','d','e','f')[0,2,4]; +print $foo eq 'e' ? "ok 35\n" : "not ok 35\n"; + +$foo = ('a','b','c','d','e','f')[1]; +print $foo eq 'b' ? "ok 36\n" : "not ok 36\n"; diff --git a/t/op.mkdir b/t/op.mkdir index 7c13e994dd..01dc6ca7b8 100644 --- a/t/op.mkdir +++ b/t/op.mkdir @@ -1,13 +1,13 @@ #!./perl -# $Header: op.mkdir,v 3.0.1.2 90/02/28 18:35:31 lwall Locked $ +# $Header: op.mkdir,v 3.0.1.3 90/03/12 17:03:57 lwall Locked $ print "1..7\n"; `rm -rf blurfl`; -print (mkdir('blurfl',0666) ? "ok 1\n" : "not ok 1\n"); -print (mkdir('blurfl',0666) ? "not ok 2\n" : "ok 2\n"); +print (mkdir('blurfl',0777) ? "ok 1\n" : "not ok 1\n"); +print (mkdir('blurfl',0777) ? "not ok 2\n" : "ok 2\n"); print ($! =~ /exists/ ? "ok 3\n" : "not ok 3\n"); print (-d 'blurfl' ? "ok 4\n" : "not ok 4\n"); print (rmdir('blurfl') ? "ok 5\n" : "not ok 5\n"); @@ -1,11 +1,44 @@ #!./perl -# $Header: op.push,v 3.0 89/10/18 15:30:48 lwall Locked $ +# $Header: op.push,v 3.0.1.1 90/03/12 17:04:27 lwall Locked $ -print "1..2\n"; +@tests = split(/\n/, <<EOF); +0 3, 0 1 2, 3 4 5 6 7 +0 0 a b c, , a b c 0 1 2 3 4 5 6 7 +8 0 a b c, , 0 1 2 3 4 5 6 7 a b c +7 0 6.5, , 0 1 2 3 4 5 6 6.5 7 +1 0 a b c d e f g h i j,, 0 a b c d e f g h i j 1 2 3 4 5 6 7 +0 1 a, 0, a 1 2 3 4 5 6 7 +1 6 x y z, 1 2 3 4 5 6, 0 x y z 7 +0 7 x y z, 0 1 2 3 4 5 6, x y z 7 +1 7 x y z, 1 2 3 4 5 6 7, 0 x y z +4, 4 5 6 7, 0 1 2 3 +-4, 4 5 6 7, 0 1 2 3 +EOF + +print "1..", 2 + @tests, "\n"; +die "blech" unless @tests; @x = (1,2,3); push(@x,@x); if (join(':',@x) eq '1:2:3:1:2:3') {print "ok 1\n";} else {print "not ok 1\n";} push(x,4); if (join(':',@x) eq '1:2:3:1:2:3:4') {print "ok 2\n";} else {print "not ok 2\n";} + +$test = 3; +foreach $line (@tests) { + ($list,$get,$leave) = split(/,\t*/,$line); + @list = split(' ',$list); + @get = split(' ',$get); + @leave = split(' ',$leave); + @x = (0,1,2,3,4,5,6,7); + @got = splice(@x,@list); + if (join(':',@got) eq join(':',@get) && + join(':',@x) eq join(':',@leave)) { + print "ok ",$test++,"\n"; + } + else { + print "not ok ",$test++," got: @got == @get left: @x == @leave\n"; + } +} + |