X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FUnicode%2FUCD.t;h=c9903e57434b6db852d463fff30dc11508a0abea;hb=06c0cc96ebd866767a6d107ed78967600f7e0395;hp=f0a29add5d7f8adcbab7d6da6fc0e1ddea1de00e;hpb=7be0dac30b98062294521bd59732f1029a6de1ce;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/Unicode/UCD.t b/lib/Unicode/UCD.t index f0a29ad..c9903e5 100644 --- a/lib/Unicode/UCD.t +++ b/lib/Unicode/UCD.t @@ -1,3 +1,4 @@ +#!perl -w BEGIN { if (ord("A") == 193) { print "1..0 # Skip: EBCDIC\n"; @@ -6,13 +7,18 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; @INC = "::lib" if $^O eq 'MacOS'; # module parses @INC itself + require Config; import Config; + if ($Config{'extensions'} !~ /\bStorable\b/) { + print "1..0 # Skip: Storable was not built; Unicode::UCD uses Storable\n"; + exit 0; + } } use strict; use Unicode::UCD; use Test::More; -BEGIN { plan tests => 179 }; +BEGIN { plan tests => 188 }; use Unicode::UCD 'charinfo'; @@ -232,7 +238,7 @@ ok( charinrange($ranges, "13a0")); ok( charinrange($ranges, "13f4")); ok(!charinrange($ranges, "13f5")); -is(Unicode::UCD::UnicodeVersion, '4.0.1', 'UnicodeVersion'); +is(Unicode::UCD::UnicodeVersion, '4.1.0', 'UnicodeVersion'); use Unicode::UCD qw(compexcl); @@ -269,12 +275,12 @@ ok($casespec->{code} eq '00DF' && $casespec->{lower} eq '00DF' && $casespec->{title} eq '0053 0073' && $casespec->{upper} eq '0053 0053' && - $casespec->{condition} eq undef, 'casespec 0xDF'); + !defined $casespec->{condition}, 'casespec 0xDF'); $casespec = casespec(0x307); ok($casespec->{az}->{code} eq '0307' && - $casespec->{az}->{lower} eq '' && + !defined $casespec->{az}->{lower} && $casespec->{az}->{title} eq '0307' && $casespec->{az}->{upper} eq '0307' && $casespec->{az}->{condition} eq 'az After_I', @@ -282,7 +288,7 @@ ok($casespec->{az}->{code} eq '0307' && # perl #7305 UnicodeCD::compexcl is weird -for (1) {$a=compexcl $_} +for (1) {my $a=compexcl $_} ok(1, 'compexcl read-only $_: perl #7305'); grep {compexcl $_} %{{1=>2}}; ok(1, 'compexcl read-only hash: perl #7305'); @@ -303,7 +309,7 @@ is(Unicode::UCD::_getcode('U+123x'), undef, "_getcode(x123)"); { my $r1 = charscript('Latin'); my $n1 = @$r1; - is($n1, 26, "26 ranges in Latin script (Unicode 4.0.0)"); + is($n1, 29, "29 ranges in Latin script (Unicode 4.1.0)"); shift @$r1 while @$r1; my $r2 = charscript('Latin'); is(@$r2, $n1, "modifying results should not mess up internal caches"); @@ -311,4 +317,20 @@ is(Unicode::UCD::_getcode('U+123x'), undef, "_getcode(x123)"); { is(charinfo(0xdeadbeef), undef, "[perl #23273] warnings in Unicode::UCD"); -} \ No newline at end of file +} + +use Unicode::UCD qw(namedseq); + +is(namedseq("KATAKANA LETTER AINU P"), "\x{31F7}\x{309A}", "namedseq"); +is(namedseq("KATAKANA LETTER AINU Q"), undef); +is(namedseq(), undef); +is(namedseq(qw(foo bar)), undef); +my @ns = namedseq("KATAKANA LETTER AINU P"); +is(scalar @ns, 2); +is($ns[0], 0x31F7); +is($ns[1], 0x309A); +my %ns = namedseq(); +is($ns{"KATAKANA LETTER AINU P"}, "\x{31F7}\x{309A}"); +@ns = namedseq(42); +is(@ns, 0); +