Commit | Line | Data |
e524f5b2 |
1 | |
2 | BEGIN { |
3 | unless ("A" eq pack('U', 0x41)) { |
4 | print "1..0 # Unicode::Normalize " . |
5 | "cannot stringify a Unicode code point\n"; |
6 | exit 0; |
7 | } |
8 | } |
9 | |
10 | BEGIN { |
11 | if ($ENV{PERL_CORE}) { |
12 | chdir('t') if -d 't'; |
13 | @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); |
14 | } |
15 | } |
16 | |
a092bcfd |
17 | BEGIN { |
18 | unless (5.006001 <= $]) { |
19 | print "1..0 # skipped: Perl 5.6.1 or later". |
20 | " needed for this test\n"; |
21 | exit; |
22 | } |
23 | } |
24 | |
e524f5b2 |
25 | ######################### |
26 | |
27 | use strict; |
28 | use Unicode::Normalize qw(:all); |
29 | |
30 | print "1..8\n"; |
31 | print "ok 1\n"; |
32 | |
33 | ######################### |
34 | |
35 | no warnings qw(utf8); |
36 | |
a092bcfd |
37 | # U+3042 is 3-byte length (in UTF-8/UTF-EBCDIC) |
38 | our $a = pack 'U0C', unpack 'C', "\x{3042}"; |
e524f5b2 |
39 | |
40 | print NFD($a) eq "\0" |
41 | ? "ok" : "not ok", " 2\n"; |
42 | |
43 | print NFKD($a) eq "\0" |
44 | ? "ok" : "not ok", " 3\n"; |
45 | |
46 | print NFC($a) eq "\0" |
47 | ? "ok" : "not ok", " 4\n"; |
48 | |
49 | print NFKC($a) eq "\0" |
50 | ? "ok" : "not ok", " 5\n"; |
51 | |
52 | print decompose($a) eq "\0" |
53 | ? "ok" : "not ok", " 6\n"; |
54 | |
55 | print reorder($a) eq "\0" |
56 | ? "ok" : "not ok", " 7\n"; |
57 | |
58 | print compose($a) eq "\0" |
59 | ? "ok" : "not ok", " 8\n"; |
60 | |