diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-07-05 19:33:34 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-07-05 19:33:34 +0000 |
commit | 10a6ecd25e80ad20ebf67b311125411d51e78bc0 (patch) | |
tree | 2c2cd3bb425c933678308e2004833ef2459e8b60 /lib/Unicode/UCD.t | |
parent | 3aa957f9c7dbe37b7f2fe946b886b63a07d35ac7 (diff) | |
download | perl-10a6ecd25e80ad20ebf67b311125411d51e78bc0.tar.gz |
More flexible argument understanding; add charblocks() and
charscripts(); make charblock() and charscript() two-way;
add charinrange(); separate the $Unicode::UCD::VERSION and
the version of the Unicode by adding UnicodeVersion().
p4raw-id: //depot/perl@11163
Diffstat (limited to 'lib/Unicode/UCD.t')
-rw-r--r-- | lib/Unicode/UCD.t | 47 |
1 files changed, 44 insertions, 3 deletions
diff --git a/lib/Unicode/UCD.t b/lib/Unicode/UCD.t index 42c9a90d3e..51e200b56c 100644 --- a/lib/Unicode/UCD.t +++ b/lib/Unicode/UCD.t @@ -1,9 +1,9 @@ -use Unicode::UCD 3.1.0; +use Unicode::UCD; use Test; use strict; -BEGIN { plan tests => 87 }; +BEGIN { plan tests => 103 }; use Unicode::UCD 'charinfo'; @@ -91,7 +91,7 @@ ok($charinfo{upper}, ''); ok($charinfo{lower}, ''); ok($charinfo{title}, ''); ok($charinfo{block}, 'Hebrew'); -ok($charinfo{script}, 'HEBREW'); +ok($charinfo{script}, 'Hebrew'); use Unicode::UCD qw(charblock charscript); @@ -119,3 +119,44 @@ ok($charinfo{lower}, ''); ok($charinfo{title}, ''); ok($charinfo{block}, 'Latin-1 Supplement'); ok($charinfo{script}, undef); + +use Unicode::UCD qw(charblocks charscripts); + +my %charblocks = charblocks(); + +ok(exists $charblocks{Thai}); +ok($charblocks{Thai}->[0]->[0], hex('0e00')); +ok(!exists $charblocks{PigLatin}); + +my %charscripts = charscripts(); + +ok(exists $charscripts{Armenian}); +ok($charscripts{Armenian}->[0]->[0], hex('0531')); +ok(!exists $charscripts{PigLatin}); + +my $charscript; + +$charscript = charscript("12ab"); +ok($charscript, 'Ethiopic'); + +$charscript = charscript("0x12ab"); +ok($charscript, 'Ethiopic'); + +$charscript = charscript("U+12ab"); +ok($charscript, 'Ethiopic'); + +my $ranges; + +$ranges = charscript('Ogham'); +ok($ranges->[0]->[0], hex('1681')); +ok($ranges->[0]->[1], hex('169a')); + +use Unicode::UCD qw(charinrange); + +$ranges = charscript('Cherokee'); +ok(!charinrange($ranges, "139f")); +ok( charinrange($ranges, "13a0")); +ok( charinrange($ranges, "13f4")); +ok(!charinrange($ranges, "13f5")); + +ok(Unicode::UCD::UnicodeVersion, 3.1); |