diff options
author | Abigail <abigail@abigail.be> | 2012-03-14 00:56:07 +0100 |
---|---|---|
committer | Abigail <abigail@abigail.be> | 2012-03-14 02:40:05 +0100 |
commit | b7657688a7a906fc8146026c4cac58976ed20856 (patch) | |
tree | 3523f499097932968b0323a2de5435a3293041fa /cpan | |
parent | 30faa5652ea0cfe6248ed70f321dcfdf9cea7bcd (diff) | |
download | perl-b7657688a7a906fc8146026c4cac58976ed20856.tar.gz |
Upgrade Unicode::Normalize to 1.14.
Diffstat (limited to 'cpan')
-rw-r--r-- | cpan/Unicode-Normalize/Changes | 3 | ||||
-rw-r--r-- | cpan/Unicode-Normalize/Makefile.PL | 1 | ||||
-rw-r--r-- | cpan/Unicode-Normalize/Normalize.pm | 5 | ||||
-rw-r--r-- | cpan/Unicode-Normalize/README | 4 | ||||
-rw-r--r-- | cpan/Unicode-Normalize/t/fcdc.t | 28 | ||||
-rw-r--r-- | cpan/Unicode-Normalize/t/form.t | 16 | ||||
-rw-r--r-- | cpan/Unicode-Normalize/t/func.t | 31 | ||||
-rw-r--r-- | cpan/Unicode-Normalize/t/illegal.t | 15 | ||||
-rw-r--r-- | cpan/Unicode-Normalize/t/norm.t | 27 | ||||
-rw-r--r-- | cpan/Unicode-Normalize/t/partial1.t | 21 | ||||
-rw-r--r-- | cpan/Unicode-Normalize/t/partial2.t | 21 | ||||
-rw-r--r-- | cpan/Unicode-Normalize/t/proto.t | 24 | ||||
-rw-r--r-- | cpan/Unicode-Normalize/t/split.t | 23 | ||||
-rw-r--r-- | cpan/Unicode-Normalize/t/test.t | 34 | ||||
-rw-r--r-- | cpan/Unicode-Normalize/t/tie.t | 14 |
15 files changed, 216 insertions, 51 deletions
diff --git a/cpan/Unicode-Normalize/Changes b/cpan/Unicode-Normalize/Changes index 789414c237..88df63cb4d 100644 --- a/cpan/Unicode-Normalize/Changes +++ b/cpan/Unicode-Normalize/Changes @@ -1,5 +1,8 @@ Revision history for Perl extension Unicode::Normalize. +1.14 Sat Mar 10 13:34:53 2012 + - avoid "use Test". + 1.13 Mon Jul 25 21:07:49 2011 - tried fixing the tarball with world writable files. ( http://www.perlmonks.org/?node_id=731935 ) diff --git a/cpan/Unicode-Normalize/Makefile.PL b/cpan/Unicode-Normalize/Makefile.PL index cf0644bd5a..f0b94e7496 100644 --- a/cpan/Unicode-Normalize/Makefile.PL +++ b/cpan/Unicode-Normalize/Makefile.PL @@ -28,7 +28,6 @@ WriteMakefile( File::Copy => 0, File::Spec => 0, strict => 0, - Test => 0, warnings => 0, }, ); diff --git a/cpan/Unicode-Normalize/Normalize.pm b/cpan/Unicode-Normalize/Normalize.pm index 906f219ca3..c580f4852c 100644 --- a/cpan/Unicode-Normalize/Normalize.pm +++ b/cpan/Unicode-Normalize/Normalize.pm @@ -13,7 +13,7 @@ use Carp; no warnings 'utf8'; -our $VERSION = '1.13'; +our $VERSION = '1.14'; our $PACKAGE = __PACKAGE__; our @EXPORT = qw( NFC NFD NFKC NFKD ); @@ -550,6 +550,7 @@ normalization implemented by this module depends on your perl's version. 5.8.9, 5.10.1 5.1.0 5.12.0-5.12.3 5.2.0 5.14.0 6.0.0 + 5.16.0 (to be) 6.1.0 =item Correction of decomposition mapping @@ -577,7 +578,7 @@ lower than 4.1.0. SADAHIRO Tomoyuki <SADAHIRO@cpan.org> -Copyright(C) 2001-2011, SADAHIRO Tomoyuki. Japan. All rights reserved. +Copyright(C) 2001-2012, SADAHIRO Tomoyuki. Japan. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/cpan/Unicode-Normalize/README b/cpan/Unicode-Normalize/README index 7ba3701faa..958df4e1bd 100644 --- a/cpan/Unicode-Normalize/README +++ b/cpan/Unicode-Normalize/README @@ -1,4 +1,4 @@ -Unicode/Normalize version 1.13 +Unicode/Normalize version 1.14 =================================== Unicode::Normalize - Unicode Normalization Forms @@ -82,7 +82,7 @@ COPYRIGHT AND LICENSE SADAHIRO Tomoyuki <SADAHIRO@cpan.org> -Copyright(C) 2001-2011, SADAHIRO Tomoyuki. Japan. All rights reserved. +Copyright(C) 2001-2012, SADAHIRO Tomoyuki. Japan. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/cpan/Unicode-Normalize/t/fcdc.t b/cpan/Unicode-Normalize/t/fcdc.t index 1cc0db181c..e62c4ea18c 100644 --- a/cpan/Unicode-Normalize/t/fcdc.t +++ b/cpan/Unicode-Normalize/t/fcdc.t @@ -16,12 +16,22 @@ BEGIN { ######################### -use Test; use strict; use warnings; -BEGIN { plan tests => 70 }; +BEGIN { $| = 1; print "1..70\n"; } +my $count = 0; +sub ok ($;$) { + my $p = my $r = shift; + if (@_) { + my $x = shift; + $p = !defined $x ? !defined $r : !defined $r ? 0 : $r eq $x; + } + print $p ? "ok" : "not ok", ' ', ++$count, "\n"; +} + use Unicode::Normalize qw(:all); -ok(1); # If we made it this far, we're ok. + +ok(1); sub _pack_U { Unicode::Normalize::pack_U(@_) } sub hexU { _pack_U map hex, split ' ', shift } @@ -39,6 +49,8 @@ ok(normalize('FCC', ""), ""); ok(normalize('FCC', "A"), "A"); ok(normalize('FCD', "A"), "A"); +# 9 + # if checkFCD is YES, the return value from FCD should be same as the original ok(FCD(hexU("00C5")), hexU("00C5")); # A with ring above ok(FCD(hexU("0041 030A")), hexU("0041 030A")); # A+ring @@ -52,6 +64,8 @@ ok(normalize('FCD', hexU("0041 0327 030A")), hexU("0041 0327 030A")); ok(normalize('FCD', hexU("AC01 1100 1161")), hexU("AC01 1100 1161")); ok(normalize('FCD', hexU("212B F900")), hexU("212B F900")); +# 19 + # if checkFCD is MAYBE or NO, FCD returns NFD (this behavior isn't documented) ok(FCD(hexU("00C5 0327")), hexU("0041 0327 030A")); ok(FCD(hexU("0041 030A 0327")), hexU("0041 0327 030A")); @@ -63,6 +77,8 @@ ok(normalize('FCD', hexU("0041 030A 0327")), hexU("0041 0327 030A")); ok(normalize('FCD', hexU("00C5 0327")), NFD(hexU("00C5 0327"))); ok(normalize('FCD', hexU("0041 030A 0327")), NFD(hexU("0041 030A 0327"))); +# 27 + ok(answer(checkFCD('')), 'YES'); ok(answer(checkFCD('A')), 'YES'); ok(answer(checkFCD("\x{030A}")), 'YES'); # 030A;COMBINING RING ABOVE @@ -83,6 +99,8 @@ ok(answer(checkFCC(hexU("1EA7 05AE 0315 0062"))), "NO"); ok(answer(check('FCD', hexU("1EA7 05AE 0315 0062"))), "NO"); ok(answer(check('FCC', hexU("1EA7 05AE 0315 0062"))), "NO"); +# 45 + ok(FCC(hexU("00C5 0327")), hexU("0041 0327 030A")); ok(FCC(hexU("0045 0304 0300")), "\x{1E14}"); ok(FCC("\x{1100}\x{1161}\x{1100}\x{1173}\x{11AF}"), "\x{AC00}\x{AE00}"); @@ -97,6 +115,8 @@ ok(FCC("\x{1100}\x{1161}\x{0300}"), "\x{AC00}\x{0300}"); ok(FCC("\x{0B47}\x{300}\x{0B3E}\x{327}"), "\x{0B47}\x{300}\x{0B3E}\x{327}"); ok(FCC("\x{1100}\x{300}\x{1161}\x{327}"), "\x{1100}\x{300}\x{1161}\x{327}"); +# 57 + ok(answer(checkFCC('')), 'YES'); ok(answer(checkFCC('A')), 'YES'); ok(answer(checkFCC("\x{030A}")), 'MAYBE'); # 030A;COMBINING RING ABOVE @@ -111,3 +131,5 @@ ok(answer(checkFCC("\x{212B}\x{F900}")), 'NO'); # compat ok(answer(checkFCC("\x{212B}\x{0327}")), 'NO'); # compat ok(answer(checkFCC("\x{0327}\x{212B}")), 'NO'); # compat +# 70 + diff --git a/cpan/Unicode-Normalize/t/form.t b/cpan/Unicode-Normalize/t/form.t index 27cd177596..c9b424906d 100644 --- a/cpan/Unicode-Normalize/t/form.t +++ b/cpan/Unicode-Normalize/t/form.t @@ -16,12 +16,22 @@ BEGIN { ######################### -use Test; use strict; use warnings; -BEGIN { plan tests => 37 }; +BEGIN { $| = 1; print "1..37\n"; } +my $count = 0; +sub ok ($;$) { + my $p = my $r = shift; + if (@_) { + my $x = shift; + $p = !defined $x ? !defined $r : !defined $r ? 0 : $r eq $x; + } + print $p ? "ok" : "not ok", ' ', ++$count, "\n"; +} + use Unicode::Normalize qw(:all); -ok(1); # If we made it this far, we're ok. + +ok(1); sub answer { defined $_[0] ? $_[0] ? "YES" : "NO" : "MAYBE" } diff --git a/cpan/Unicode-Normalize/t/func.t b/cpan/Unicode-Normalize/t/func.t index f18835ee8a..d8d8d952e0 100644 --- a/cpan/Unicode-Normalize/t/func.t +++ b/cpan/Unicode-Normalize/t/func.t @@ -16,12 +16,22 @@ BEGIN { ######################### -use Test; use strict; use warnings; -BEGIN { plan tests => 217 }; +BEGIN { $| = 1; print "1..217\n"; } +my $count = 0; +sub ok ($;$) { + my $p = my $r = shift; + if (@_) { + my $x = shift; + $p = !defined $x ? !defined $r : !defined $r ? 0 : $r eq $x; + } + print $p ? "ok" : "not ok", ' ', ++$count, "\n"; +} + use Unicode::Normalize qw(:all); -ok(1); # If we made it this far, we're ok. + +ok(1); sub _pack_U { Unicode::Normalize::pack_U(@_) } sub hexU { _pack_U map hex, split ' ', shift } @@ -66,6 +76,8 @@ ok(getCompat(0xAC00), _pack_U(0x1100, 0x1161)); ok(getCompat(0xAE00), _pack_U(0x1100, 0x1173, 0x11AF)); ok(getCompat(0xFA2D), _pack_U(0x9DB4)); +# 34 + ok(getComposite( 0, 0), undef); ok(getComposite( 0, 0x29), undef); ok(getComposite(0x29, 0), undef); @@ -139,13 +151,13 @@ ok(decompose(hexU("1E14 AC01"), 1), hexU("0045 0304 0300 1100 1161 11A8")); ok(decompose(hexU("AC00 AE00"), 1), hexU("1100 1161 1100 1173 11AF")); ok(decompose(hexU("304C FF76"), 1), hexU("304B 3099 30AB")); -# 81 - # don't modify the source my $sDec = "\x{FA19}"; ok(decompose($sDec), "\x{795E}"); ok($sDec, "\x{FA19}"); +# 83 + ok(reorder(""), ""); ok(reorder("A"), "A"); ok(reorder(hexU("0041 0300 0315 0313 031b 0061")), @@ -158,6 +170,8 @@ my $sReord = "\x{3000}\x{300}\x{31b}"; ok(reorder($sReord), "\x{3000}\x{31b}\x{300}"); ok($sReord, "\x{3000}\x{300}\x{31b}"); +# 89 + ok(compose(""), ""); ok(compose("A"), "A"); ok(compose(hexU("0061 0300")), hexU("00E0")); @@ -244,6 +258,8 @@ ok(normalize('NFC', $1), "012"); ok(normalize('NFC', $2), "ABC"); # s/^NF// in normalize() must not prevent using $1, $&, etc. +# 150 + # a string with initial zero should be treated like a number # LATIN CAPITAL LETTER A WITH GRAVE @@ -254,8 +270,6 @@ ok(getComposite("065", "0768"), 192); ok(isNFD_NO ("0192")); ok(isNFKD_NO("0192")); -# 156 - # DEVANAGARI LETTER QA ok(isExclusion("02392")); ok(isComp_Ex ("02392")); @@ -307,6 +321,8 @@ ok(NFKC($str_cc22), $str_cc22); ok(FCD($str_cc22), $str_cc22); ok(FCC($str_cc22), $str_cc22); +# 192 + # string with 40 combining characters of the same class: (0x300..0x313)x2 my $str_cc40 = _pack_U(0x3041, 0x300..0x313, 0x300..0x313, 0x3042); ok(decompose($str_cc40), $str_cc40); @@ -357,3 +373,4 @@ ok($preUnicode3_2 xor isExclusion(0x2ADC)); ok($preUnicode3_2 xor isComp_Ex (0x2ADC)); # 217 + diff --git a/cpan/Unicode-Normalize/t/illegal.t b/cpan/Unicode-Normalize/t/illegal.t index 976e5097a2..bcd9517f6d 100644 --- a/cpan/Unicode-Normalize/t/illegal.t +++ b/cpan/Unicode-Normalize/t/illegal.t @@ -35,16 +35,25 @@ BEGIN { } } -use Test; use strict; use warnings; -BEGIN { plan tests => 112 }; +BEGIN { $| = 1; print "1..113\n"; } +my $count = 0; +sub ok ($;$) { + my $p = my $r = shift; + if (@_) { + my $x = shift; + $p = !defined $x ? !defined $r : !defined $r ? 0 : $r eq $x; + } + print $p ? "ok" : "not ok", ' ', ++$count, "\n"; +} + +ok(1); ######################### no warnings qw(utf8); -# To avoid warning in Test.pm, EXPR in ok(EXPR) must be boolean. for my $u (0xD800, 0xDFFF, 0xFDD0, 0xFDEF, 0xFEFF, 0xFFFE, 0xFFFF, 0x1FFFF, 0x10FFFF, 0x110000, 0x7FFFFFFF) diff --git a/cpan/Unicode-Normalize/t/norm.t b/cpan/Unicode-Normalize/t/norm.t index 5d93747965..1442c30000 100644 --- a/cpan/Unicode-Normalize/t/norm.t +++ b/cpan/Unicode-Normalize/t/norm.t @@ -16,12 +16,22 @@ BEGIN { ######################### -use Test; use strict; use warnings; -BEGIN { plan tests => 64 }; +BEGIN { $| = 1; print "1..64\n"; } +my $count = 0; +sub ok ($;$) { + my $p = my $r = shift; + if (@_) { + my $x = shift; + $p = !defined $x ? !defined $r : !defined $r ? 0 : $r eq $x; + } + print $p ? "ok" : "not ok", ' ', ++$count, "\n"; +} + use Unicode::Normalize qw(normalize); -ok(1); # If we made it this far, we're ok. + +ok(1); sub _pack_U { Unicode::Normalize::pack_U(@_) } sub _unpack_U { Unicode::Normalize::unpack_U(@_) } @@ -48,6 +58,8 @@ ok(normalize('NFC', "A"), "A"); ok(normalize('NFKD',"A"), "A"); ok(normalize('NFKC',"A"), "A"); +# 17 + # don't modify the source my $sNFD = "\x{FA19}"; ok(normalize('NFD', $sNFD), "\x{795E}"); @@ -65,6 +77,8 @@ my $sNFKC = "\x{FA26}"; ok(normalize('NFKC', $sNFKC), "\x{90FD}"); ok($sNFKC, "\x{FA26}"); +# 25 + sub hexNFC { join " ", map sprintf("%04X", $_), _unpack_U normalize 'C', _pack_U map hex, split ' ', shift; @@ -100,14 +114,14 @@ ok(hexNFC("AC00 11A9"), "AC02"); ok(hexNFC("AC00 11C2"), "AC1B"); ok(hexNFC("AC00 11C3"), "AC00 11C3"); +# 47 + # Test Cases from Public Review Issue #29: Normalization Issue # cf. http://www.unicode.org/review/pr-29.html ok(hexNFC("0B47 0300 0B3E"), "0B47 0300 0B3E"); ok(hexNFC("1100 0300 1161"), "1100 0300 1161"); - ok(hexNFC("0B47 0B3E 0300"), "0B4B 0300"); ok(hexNFC("1100 1161 0300"), "AC00 0300"); - ok(hexNFC("0B47 0300 0B3E 0327"), "0B47 0300 0B3E 0327"); ok(hexNFC("1100 0300 1161 0327"), "1100 0300 1161 0327"); @@ -123,3 +137,6 @@ ok(hexNFC("0315 0061 0300"), "0315 00E0"); ok(hexNFC("0000 0327 0061 0300"), "0000 0327 00E0"); ok(hexNFC("0000 0301 0061 0300"), "0000 0301 00E0"); ok(hexNFC("0000 0315 0061 0300"), "0000 0315 00E0"); + +# 64 + diff --git a/cpan/Unicode-Normalize/t/partial1.t b/cpan/Unicode-Normalize/t/partial1.t index d8158511a9..56f2ca4427 100644 --- a/cpan/Unicode-Normalize/t/partial1.t +++ b/cpan/Unicode-Normalize/t/partial1.t @@ -24,12 +24,22 @@ BEGIN { ######################### -use Test; use strict; use warnings; -BEGIN { plan tests => 26 }; +BEGIN { $| = 1; print "1..26\n"; } +my $count = 0; +sub ok ($;$) { + my $p = my $r = shift; + if (@_) { + my $x = shift; + $p = !defined $x ? !defined $r : !defined $r ? 0 : $r eq $x; + } + print $p ? "ok" : "not ok", ' ', ++$count, "\n"; +} + use Unicode::Normalize qw(:all); -ok(1); # If we made it this far, we're ok. + +ok(1); sub _pack_U { Unicode::Normalize::pack_U(@_) } sub _unpack_U { Unicode::Normalize::unpack_U(@_) } @@ -84,7 +94,7 @@ ok($strZ eq arraynorm('NFD', @strZ)); ok($strZ eq NFKD(join('', @strZ))); ok($strZ eq arraynorm('NFKD', @strZ)); -#### +# 18 # must modify the source my $sNFD = "\x{FA19}"; @@ -102,3 +112,6 @@ ok($sNFKD, "\x{7FBD}"); my $sNFKC = "\x{FA26}"; ok(NFKC_partial($sNFKC), ""); ok($sNFKC, "\x{90FD}"); + +# 26 + diff --git a/cpan/Unicode-Normalize/t/partial2.t b/cpan/Unicode-Normalize/t/partial2.t index 4dcdb79289..4d824a4418 100644 --- a/cpan/Unicode-Normalize/t/partial2.t +++ b/cpan/Unicode-Normalize/t/partial2.t @@ -24,12 +24,22 @@ BEGIN { ######################### -use Test; use strict; use warnings; -BEGIN { plan tests => 26 }; +BEGIN { $| = 1; print "1..26\n"; } +my $count = 0; +sub ok ($;$) { + my $p = my $r = shift; + if (@_) { + my $x = shift; + $p = !defined $x ? !defined $r : !defined $r ? 0 : $r eq $x; + } + print $p ? "ok" : "not ok", ' ', ++$count, "\n"; +} + use Unicode::Normalize qw(:all); -ok(1); # If we made it this far, we're ok. + +ok(1); sub _pack_U { Unicode::Normalize::pack_U(@_) } sub _unpack_U { Unicode::Normalize::unpack_U(@_) } @@ -80,7 +90,7 @@ ok($strZ eq arraynorm('NFD', @strZ)); ok($strZ eq NFKD(join('', @strZ))); ok($strZ eq arraynorm('NFKD', @strZ)); -#### +# 18 # must modify the source my $sNFD = "\x{FA19}"; @@ -98,3 +108,6 @@ ok($sNFKD, "\x{7FBD}"); my $sNFKC = "\x{FA26}"; ok(normalize_partial('NFKC', $sNFKC), ""); ok($sNFKC, "\x{90FD}"); + +# 26 + diff --git a/cpan/Unicode-Normalize/t/proto.t b/cpan/Unicode-Normalize/t/proto.t index 531f97514c..714018a68e 100644 --- a/cpan/Unicode-Normalize/t/proto.t +++ b/cpan/Unicode-Normalize/t/proto.t @@ -16,12 +16,22 @@ BEGIN { ######################### -use Test; use strict; use warnings; -BEGIN { plan tests => 48 }; +BEGIN { $| = 1; print "1..48\n"; } +my $count = 0; +sub ok ($;$) { + my $p = my $r = shift; + if (@_) { + my $x = shift; + $p = !defined $x ? !defined $r : !defined $r ? 0 : $r eq $x; + } + print $p ? "ok" : "not ok", ' ', ++$count, "\n"; +} + use Unicode::Normalize qw(:all); -ok(1); # If we made it this far, we're ok. + +ok(1); ######################### @@ -35,6 +45,8 @@ ok(FCD "\x{30A}\x{327}" eq "\x{327}\x{30A}"); ok(FCC "\x{30A}\x{327}" eq "\x{327}\x{30A}"); ok(reorder "\x{30A}\x{327}" eq "\x{327}\x{30A}"); +# 9 + ok(prototype \&normalize,'$$'); ok(prototype \&NFD, '$'); ok(prototype \&NFC, '$'); @@ -56,6 +68,8 @@ ok(prototype \&reorder, '$'); ok(prototype \&compose, '$'); ok(prototype \&composeContiguous, '$'); +# 27 + ok(prototype \&getCanon, '$'); ok(prototype \&getCompat, '$'); ok(prototype \&getComposite, '$$'); @@ -65,14 +79,12 @@ ok(prototype \&isSingleton, '$'); ok(prototype \&isNonStDecomp, '$'); ok(prototype \&isComp2nd, '$'); ok(prototype \&isComp_Ex, '$'); - ok(prototype \&isNFD_NO, '$'); ok(prototype \&isNFC_NO, '$'); ok(prototype \&isNFC_MAYBE, '$'); ok(prototype \&isNFKD_NO, '$'); ok(prototype \&isNFKC_NO, '$'); ok(prototype \&isNFKC_MAYBE, '$'); - ok(prototype \&splitOnLastStarter, undef); ok(prototype \&normalize_partial, '$$'); ok(prototype \&NFD_partial, '$'); @@ -80,3 +92,5 @@ ok(prototype \&NFC_partial, '$'); ok(prototype \&NFKD_partial, '$'); ok(prototype \&NFKC_partial, '$'); +# 48 + diff --git a/cpan/Unicode-Normalize/t/split.t b/cpan/Unicode-Normalize/t/split.t index a8275bff88..fe579cdd0d 100644 --- a/cpan/Unicode-Normalize/t/split.t +++ b/cpan/Unicode-Normalize/t/split.t @@ -24,12 +24,22 @@ BEGIN { ######################### -use Test; use strict; use warnings; -BEGIN { plan tests => 34 }; +BEGIN { $| = 1; print "1..34\n"; } +my $count = 0; +sub ok ($;$) { + my $p = my $r = shift; + if (@_) { + my $x = shift; + $p = !defined $x ? !defined $r : !defined $r ? 0 : $r eq $x; + } + print $p ? "ok" : "not ok", ' ', ++$count, "\n"; +} + use Unicode::Normalize qw(:all); -ok(1); # If we made it this far, we're ok. + +ok(1); sub _pack_U { Unicode::Normalize::pack_U(@_) } sub _unpack_U { Unicode::Normalize::unpack_U(@_) } @@ -71,7 +81,7 @@ ok(NFC($ka_grave.$dakuten) eq $ga_grave); ok(NFC($ka_grave).NFC($dakuten) ne $ga_grave); ok($concat eq $ga_grave); -############## +# 14 sub arraynorm { my $form = shift; @@ -120,7 +130,7 @@ ok($strZ eq arraynorm('NFD', @strZ)); ok($strZ eq NFKD(join('', @strZ))); ok($strZ eq arraynorm('NFKD', @strZ)); -############## +# 31 # don't modify the source @@ -129,3 +139,6 @@ my $source = "ABC"; ok($proc, "AB"); ok($unproc, "C"); ok($source, "ABC"); + +# 34 + diff --git a/cpan/Unicode-Normalize/t/test.t b/cpan/Unicode-Normalize/t/test.t index 2dea2a1402..f69c695f10 100644 --- a/cpan/Unicode-Normalize/t/test.t +++ b/cpan/Unicode-Normalize/t/test.t @@ -16,12 +16,22 @@ BEGIN { ######################### -use Test; use strict; use warnings; -BEGIN { plan tests => 70 }; +BEGIN { $| = 1; print "1..72\n"; } +my $count = 0; +sub ok ($;$) { + my $p = my $r = shift; + if (@_) { + my $x = shift; + $p = !defined $x ? !defined $r : !defined $r ? 0 : $r eq $x; + } + print $p ? "ok" : "not ok", ' ', ++$count, "\n"; +} + use Unicode::Normalize; -ok(1); # If we made it this far, we're ok. + +ok(1); sub _pack_U { Unicode::Normalize::pack_U(@_) } sub _unpack_U { Unicode::Normalize::unpack_U(@_) } @@ -38,6 +48,8 @@ ok(NFC("A"), "A"); ok(NFKD("A"), "A"); ok(NFKC("A"), "A"); +# 9 + # don't modify the source my $sNFD = "\x{FA19}"; ok(NFD($sNFD), "\x{795E}"); @@ -55,6 +67,7 @@ my $sNFKC = "\x{FA26}"; ok(NFKC($sNFKC), "\x{90FD}"); ok($sNFKC, "\x{FA26}"); +# 17 sub hexNFC { join " ", map sprintf("%04X", $_), @@ -91,6 +104,8 @@ ok(hexNFC("AC00 11A9"), "AC02"); ok(hexNFC("AC00 11C2"), "AC1B"); ok(hexNFC("AC00 11C3"), "AC00 11C3"); +# 39 + # Test Cases from Public Review Issue #29: Normalization Issue # cf. http://www.unicode.org/review/pr-29.html ok(hexNFC("0B47 0300 0B3E"), "0B47 0300 0B3E"); @@ -113,15 +128,21 @@ ok(hexNFC("0000 0327 0061 0300"), "0000 0327 00E0"); ok(hexNFC("0000 0301 0061 0300"), "0000 0301 00E0"); ok(hexNFC("0000 0315 0061 0300"), "0000 0315 00E0"); -# NFC() should be unary. +# 56 + +# NFC() and NFKC() should be unary. my $str11 = _pack_U(0x41, 0x0302, 0x0301, 0x62); my $str12 = _pack_U(0x1EA4, 0x62); ok(NFC $str11 eq $str12); +ok(NFKC $str11 eq $str12); -# NFD() should be unary. +# NFD() and NFKD() should be unary. my $str21 = _pack_U(0xE0, 0xAC00); my $str22 = _pack_U(0x61, 0x0300, 0x1100, 0x1161); ok(NFD $str21 eq $str22); +ok(NFKD $str21 eq $str22); + +# 60 ## Bug #53197: NFKC("\x{2000}") produces... @@ -139,3 +160,6 @@ ok(NFC("\x{F907}") eq "\x{9F9C}"); ok(NFD("\x{F907}") eq "\x{9F9C}"); ok(NFKC("\x{F907}") eq "\x{9F9C}"); ok(NFKD("\x{F907}") eq "\x{9F9C}"); + +# 72 + diff --git a/cpan/Unicode-Normalize/t/tie.t b/cpan/Unicode-Normalize/t/tie.t index c721491726..be1712a505 100644 --- a/cpan/Unicode-Normalize/t/tie.t +++ b/cpan/Unicode-Normalize/t/tie.t @@ -27,10 +27,20 @@ BEGIN { } } -use Test; use strict; use warnings; -BEGIN { plan tests => 16 }; +BEGIN { $| = 1; print "1..17\n"; } +my $count = 0; +sub ok ($;$) { + my $p = my $r = shift; + if (@_) { + my $x = shift; + $p = !defined $x ? !defined $r : !defined $r ? 0 : $r eq $x; + } + print $p ? "ok" : "not ok", ' ', ++$count, "\n"; +} + +ok(1); package tiescalar; sub TIESCALAR { |