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;
}
}
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);
use Test;
use strict;
-BEGIN { plan tests => 81 };
+BEGIN { plan tests => 87 };
use Unicode::UCD 'charinfo';
ok($charinfo{lower}, '0061');
ok($charinfo{title}, '');
ok($charinfo{block}, 'Basic Latin');
+ok($charinfo{script}, 'LATIN');
%charinfo = charinfo(0x100);
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{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);
ok($charinfo{lower}, '');
ok($charinfo{title}, '');
ok($charinfo{block}, 'Hebrew');
+ok($charinfo{script}, 'HEBREW');
-use Unicode::UCD 'charblock';
+use Unicode::UCD qw(charblock charscript);
+
+# 0x0590 is in the Hebrew block but unused.
ok(charblock(0x590), 'Hebrew');
+ok(charscript(0x590), undef);
%charinfo = charinfo(0xbe);
ok($charinfo{lower}, '');
ok($charinfo{title}, '');
ok($charinfo{block}, 'Latin-1 Supplement');
-
+ok($charinfo{script}, undef);