diff options
author | Karl Williamson <public@khwilliamson.com> | 2011-03-03 19:10:06 -0700 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2011-03-03 19:26:17 -0700 |
commit | c707cf8e56262e82a832f4b1eceb109bee32ec3a (patch) | |
tree | f286af98d3a1cc8397ffb65daad435687d964b53 /lib | |
parent | 8079ad8217fc56d7ca13c7f6bae25f75e0762e6a (diff) | |
download | perl-c707cf8e56262e82a832f4b1eceb109bee32ec3a.tar.gz |
UCD.pm: All code points are in some block
Code points that are not in a block are considered to be in the
pseudo-block 'No_Block' by the Unicode standard; so change to do that
instead of 'undef'
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Unicode/UCD.pm | 13 | ||||
-rw-r--r-- | lib/Unicode/UCD.t | 3 |
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/Unicode/UCD.pm b/lib/Unicode/UCD.pm index b15b9274cc..30acd503b8 100644 --- a/lib/Unicode/UCD.pm +++ b/lib/Unicode/UCD.pm @@ -530,13 +530,12 @@ sub charblock { my $code = _getcode($arg); if (defined $code) { - _search(\@BLOCKS, 0, $#BLOCKS, $code); - } else { - if (exists $BLOCKS{$arg}) { - return dclone $BLOCKS{$arg}; - } else { - return; - } + my $result = _search(\@BLOCKS, 0, $#BLOCKS, $code); + return $result if defined $result; + return 'No_Block'; + } + elsif (exists $BLOCKS{$arg}) { + return dclone $BLOCKS{$arg}; } } diff --git a/lib/Unicode/UCD.t b/lib/Unicode/UCD.t index 00697512ba..9c57f384d1 100644 --- a/lib/Unicode/UCD.t +++ b/lib/Unicode/UCD.t @@ -17,7 +17,7 @@ use strict; use Unicode::UCD; use Test::More; -BEGIN { plan tests => 270 }; +BEGIN { plan tests => 271 }; use Unicode::UCD 'charinfo'; @@ -219,6 +219,7 @@ use Unicode::UCD qw(charblock charscript); is(charblock(0x590), 'Hebrew', '0x0590 - Hebrew unused charblock'); is(charscript(0x590), 'Unknown', '0x0590 - Hebrew unused charscript'); +is(charblock(0x1FFFF), 'No_Block', '0x1FFFF - unused charblock'); $charinfo = charinfo(0xbe); |