Change 11129 by jhi@alpha on 2001/07/03 22:45:41

        Add tests for charscript().

Affected files ...

... //depot/perl/lib/Unicode/UCD.pm#8 edit
... //depot/perl/lib/Unicode/UCD.t#2 edit

Differences ...

==== //depot/perl/lib/Unicode/UCD.pm#8 (text) ====
Index: perl/lib/Unicode/UCD.pm
--- perl/lib/Unicode/UCD.pm.~1~ Tue Jul  3 17:00:05 2001
+++ perl/lib/Unicode/UCD.pm     Tue Jul  3 17:00:05 2001
@@ -122,7 +122,8 @@
                     upper lower title
                    )} = split(/;/, $line, -1);
            if ($prop{code} eq $hexk) {
-               $prop{block} = charblock($code);
+               $prop{block}  = charblock($code);
+               $prop{script} = charscript($code);
                return %prop;
            }
        }
@@ -138,7 +139,7 @@
     my $mid = int(($lo+$hi) / 2);
 
     if ($table->[$mid]->[0] < $code) {
-       if ($table->[$mid]->[1] >= $code) {
+       if (defined $table->[$mid]->[1] && $table->[$mid]->[1] >= $code) {
            return $table->[$mid]->[2];
        } else {
            _search($table, $mid + 1, $hi, $code);

==== //depot/perl/lib/Unicode/UCD.t#2 (text) ====
Index: perl/lib/Unicode/UCD.t
--- perl/lib/Unicode/UCD.t.~1~  Tue Jul  3 17:00:05 2001
+++ perl/lib/Unicode/UCD.t      Tue Jul  3 17:00:05 2001
@@ -3,7 +3,7 @@
 use Test;
 use strict;
 
-BEGIN { plan tests => 81 };
+BEGIN { plan tests => 87 };
 
 use Unicode::UCD 'charinfo';
 
@@ -27,6 +27,7 @@
 ok($charinfo{lower},          '0061');
 ok($charinfo{title},          '');
 ok($charinfo{block},          'Basic Latin');
+ok($charinfo{script},         'LATIN');
 
 %charinfo = charinfo(0x100);
 
@@ -46,7 +47,10 @@
 ok($charinfo{lower},          '0101');
 ok($charinfo{title},          '');
 ok($charinfo{block},          'Latin Extended-A');
+ok($charinfo{script},         'LATIN');
 
+# 0x0590 is in the Hebrew block but unused.
+
 %charinfo = charinfo(0x590);
 
 ok($charinfo{code},          undef);
@@ -65,6 +69,9 @@
 ok($charinfo{lower},         undef);
 ok($charinfo{title},         undef);
 ok($charinfo{block},         undef);
+ok($charinfo{script},        undef);
+
+# 0x05d0 is in the Hebrew block and used.
 
 %charinfo = charinfo(0x5d0);
 
@@ -84,10 +91,14 @@
 ok($charinfo{lower},          '');
 ok($charinfo{title},          '');
 ok($charinfo{block},          'Hebrew');
+ok($charinfo{script},         'HEBREW');
+
+use Unicode::UCD qw(charblock charscript);
 
-use Unicode::UCD 'charblock';
+# 0x0590 is in the Hebrew block but unused.
 
 ok(charblock(0x590),          'Hebrew');
+ok(charscript(0x590),         undef);
 
 %charinfo = charinfo(0xbe);
 
@@ -107,4 +118,4 @@
 ok($charinfo{lower},          '');
 ok($charinfo{title},          '');
 ok($charinfo{block},          'Latin-1 Supplement');
-
+ok($charinfo{script},         undef);
End of Patch.

Reply via email to