diff options
Diffstat (limited to 't/op/delete.t')
-rwxr-xr-x | t/op/delete.t | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/t/op/delete.t b/t/op/delete.t index 010cbf1003..4e00566cd7 100755 --- a/t/op/delete.t +++ b/t/op/delete.t @@ -2,11 +2,13 @@ # $RCSfile: delete.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:44 $ -print "1..7\n"; +print "1..16\n"; $foo{1} = 'a'; $foo{2} = 'b'; $foo{3} = 'c'; +$foo{4} = 'd'; +$foo{5} = 'e'; $foo = delete $foo{2}; @@ -14,9 +16,21 @@ if ($foo eq 'b') {print "ok 1\n";} else {print "not ok 1 $foo\n";} if ($foo{2} eq '') {print "ok 2\n";} else {print "not ok 2 $foo{2}\n";} if ($foo{1} eq 'a') {print "ok 3\n";} else {print "not ok 3\n";} if ($foo{3} eq 'c') {print "ok 4\n";} else {print "not ok 4\n";} +if ($foo{4} eq 'd') {print "ok 5\n";} else {print "not ok 5\n";} +if ($foo{5} eq 'e') {print "ok 6\n";} else {print "not ok 6\n";} + +@foo = delete @foo{4, 5}; + +if (@foo == 2) {print "ok 7\n";} else {print "not ok 7 ", @foo+0, "\n";} +if ($foo[0] eq 'd') {print "ok 8\n";} else {print "not ok 8 ", $foo[0], "\n";} +if ($foo[1] eq 'e') {print "ok 9\n";} else {print "not ok 9 ", $foo[1], "\n";} +if ($foo{4} eq '') {print "ok 10\n";} else {print "not ok 10 $foo{4}\n";} +if ($foo{5} eq '') {print "ok 11\n";} else {print "not ok 11 $foo{5}\n";} +if ($foo{1} eq 'a') {print "ok 12\n";} else {print "not ok 12\n";} +if ($foo{3} eq 'c') {print "ok 13\n";} else {print "not ok 13\n";} $foo = join('',values(foo)); -if ($foo eq 'ac' || $foo eq 'ca') {print "ok 5\n";} else {print "not ok 5\n";} +if ($foo eq 'ac' || $foo eq 'ca') {print "ok 14\n";} else {print "not ok 14\n";} foreach $key (keys foo) { delete $foo{$key}; @@ -26,7 +40,7 @@ $foo{'foo'} = 'x'; $foo{'bar'} = 'y'; $foo = join('',values(foo)); -if ($foo eq 'xy' || $foo eq 'yx') {print "ok 6\n";} else {print "not ok 6\n";} +print +($foo eq 'xy' || $foo eq 'yx') ? "ok 15\n" : "not ok 15\n"; $refhash{"top"}->{"foo"} = "FOO"; $refhash{"top"}->{"bar"} = "BAR"; @@ -34,4 +48,4 @@ $refhash{"top"}->{"bar"} = "BAR"; delete $refhash{"top"}->{"bar"}; @list = keys %{$refhash{"top"}}; -print "@list" eq "foo" ? "ok 7\n" : "not ok 7 @list\n"; +print "@list" eq "foo" ? "ok 16\n" : "not ok 16 @list\n"; |