Commit | Line | Data |
---|---|---|
91ae00cb NC |
1 | |
2 | BEGIN { | |
3 | unless ("A" eq pack('U', 0x41)) { | |
4 | print "1..0 # Unicode::Collate " . | |
5 | "cannot stringify a Unicode code point\n"; | |
6 | exit 0; | |
7 | } | |
456a1446 CBW |
8 | if ($ENV{PERL_CORE}) { |
9 | chdir('t') if -d 't'; | |
10 | @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); | |
11 | } | |
91ae00cb NC |
12 | } |
13 | ||
91ae00cb NC |
14 | use strict; |
15 | use warnings; | |
cba8842c A |
16 | BEGIN { $| = 1; print "1..17\n"; } |
17 | my $count = 0; | |
18 | sub ok ($;$) { | |
19 | my $p = my $r = shift; | |
20 | if (@_) { | |
21 | my $x = shift; | |
22 | $p = !defined $x ? !defined $r : !defined $r ? 0 : $r eq $x; | |
23 | } | |
24 | print $p ? "ok" : "not ok", ' ', ++$count, "\n"; | |
25 | } | |
26 | ||
91ae00cb NC |
27 | use Unicode::Collate; |
28 | ||
29 | ok(1); | |
30 | ||
31 | ######################### | |
32 | ||
abd1ec54 | 33 | # Fix me when UCA and/or keys.txt is upgraded. |
cba8842c A |
34 | my $UCA_Version = "24"; |
35 | my $Base_Unicode_Version = "6.1.0"; | |
91ae00cb NC |
36 | my $Key_Version = "3.1.1"; |
37 | ||
38 | ok(Unicode::Collate::UCA_Version, $UCA_Version); | |
39 | ok(Unicode::Collate->UCA_Version, $UCA_Version); | |
40 | ok(Unicode::Collate::Base_Unicode_Version, $Base_Unicode_Version); | |
41 | ok(Unicode::Collate->Base_Unicode_Version, $Base_Unicode_Version); | |
42 | ||
43 | my $Collator = Unicode::Collate->new( | |
44 | table => 'keys.txt', | |
45 | normalization => undef, | |
46 | ); | |
47 | ||
48 | ok($Collator->UCA_Version, $UCA_Version); | |
49 | ok($Collator->UCA_Version(), $UCA_Version); | |
50 | ok($Collator->Base_Unicode_Version, $Base_Unicode_Version); | |
51 | ok($Collator->Base_Unicode_Version(), $Base_Unicode_Version); | |
52 | ok($Collator->version, $Key_Version); | |
53 | ok($Collator->version(), $Key_Version); | |
54 | ||
55 | my $UndefTable = Unicode::Collate->new( | |
56 | table => undef, | |
57 | normalization => undef, | |
58 | ); | |
59 | ||
60 | ok($UndefTable->UCA_Version, $UCA_Version); | |
61 | ok($UndefTable->UCA_Version(), $UCA_Version); | |
62 | ok($UndefTable->Base_Unicode_Version, $Base_Unicode_Version); | |
63 | ok($UndefTable->Base_Unicode_Version(), $Base_Unicode_Version); | |
64 | ok($UndefTable->version, "unknown"); | |
65 | ok($UndefTable->version(), "unknown"); | |
66 |