misc tweaks
[p5sagit/p5-mst-13.2.git] / t / lib / searchdict.t
index 447c425..c36fdb8 100755 (executable)
@@ -5,7 +5,7 @@ BEGIN {
     @INC = '../lib';
 }
 
-print "1..3\n";
+print "1..4\n";
 
 $DICT = <<EOT;
 Aarhus
@@ -44,22 +44,44 @@ open(DICT, "+>dict-$$") or die "Can't create dict-$$: $!";
 binmode DICT;                  # To make length expected one.
 print DICT $DICT;
 
-my $pos = look *DICT, "abash";
+my $pos = look *DICT, "Ababa";
 chomp($word = <DICT>);
-print "not " if $pos < 0 || $word ne "abash";
+print "not " if $pos < 0 || $word ne "Ababa";
 print "ok 1\n";
 
-$pos = look *DICT, "foo";
-chomp($word = <DICT>);
+if (ord('a') > ord('A') ) {  # ASCII
+
+    $pos = look *DICT, "foo";
+    chomp($word = <DICT>);
+
+    print "not " if $pos != length($DICT);  # will search to end of file
+    print "ok 2\n";
 
-print "not " if $pos != length($DICT);  # will search to end of file
-print "ok 2\n";
+    my $pos = look *DICT, "abash";
+    chomp($word = <DICT>);
+    print "not " if $pos < 0 || $word ne "abash";
+    print "ok 3\n";
+
+}
+else { # EBCDIC systems e.g. os390
+
+    $pos = look *DICT, "FOO";
+    chomp($word = <DICT>);
+
+    print "not " if $pos != length($DICT);  # will search to end of file
+    print "ok 2\n";
+
+    my $pos = look *DICT, "Abba";
+    chomp($word = <DICT>);
+    print "not " if $pos < 0 || $word ne "Abba";
+    print "ok 3\n";
+}
 
 $pos = look *DICT, "aarhus", 1, 1;
 chomp($word = <DICT>);
 
 print "not " if $pos < 0 || $word ne "Aarhus";
-print "ok 3\n";
+print "ok 4\n";
 
 close DICT or die "cannot close";
 unlink "dict-$$";