diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1999-04-29 22:53:00 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1999-04-29 22:53:00 +0000 |
commit | c25c5c3c87d89b68324dc98b7c8aaabc750c7cec (patch) | |
tree | 2943af9b1f84d88d863a9ba36a234877561bf5f0 /gnu/usr.bin/perl/t/op/each.t | |
parent | 37583d269f066aa8aa04ea18126b188d12257e6d (diff) |
perl5.005_03 (stock)
Diffstat (limited to 'gnu/usr.bin/perl/t/op/each.t')
-rw-r--r-- | gnu/usr.bin/perl/t/op/each.t | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/gnu/usr.bin/perl/t/op/each.t b/gnu/usr.bin/perl/t/op/each.t index b92dd1770c6..9063c2c3ed8 100644 --- a/gnu/usr.bin/perl/t/op/each.t +++ b/gnu/usr.bin/perl/t/op/each.t @@ -2,7 +2,7 @@ # $RCSfile: each.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:47 $ -print "1..14\n"; +print "1..16\n"; $h{'abc'} = 'ABC'; $h{'def'} = 'DEF'; @@ -43,7 +43,8 @@ if ($#keys == 29 && $#values == 29) {print "ok 1\n";} else {print "not ok 1\n";} $i = 0; # stop -w complaints while (($key,$value) = each(%h)) { - if ($key eq $keys[$i] && $value eq $values[$i] && $key eq lc($value)) { + if ($key eq $keys[$i] && $value eq $values[$i] + && (('a' lt 'A' && $key lt $value) || $key gt $value)) { $key =~ y/a-z/A-Z/; $i++ if $key eq $value; } @@ -107,3 +108,15 @@ print "ok 13\n"; print "not " if keys(%hash) != 10; print "ok 14\n"; +print keys(hash) != 10 ? "not ok 15\n" : "ok 15\n"; + +$i = 0; +%h = (a => A, b => B, c=> C, d => D, abc => ABC); +@keys = keys(h); +@values = values(h); +while (($key, $value) = each(h)) { + if ($key eq $keys[$i] && $value eq $values[$i] && $key eq lc($value)) { + $i++; + } +} +if ($i == 5) { print "ok 16\n" } else { print "not ok\n" } |