Commit | Line | Data |
47a334e9 |
1 | #!./perl |
2 | # |
3 | # uk.t - tests for Locale::Country with "uk" aliases to "gb" |
4 | # |
5 | |
6 | use Locale::Country; |
7 | |
8 | Locale::Country::_alias_code('uk' => 'gb'); |
9 | |
10 | #----------------------------------------------------------------------- |
11 | # This is an array of tests. Each test is eval'd as an expression. |
12 | # If it evaluates to FALSE, then "not ok N" is printed for the test, |
13 | # otherwise "ok N". |
14 | #----------------------------------------------------------------------- |
15 | @TESTS = |
16 | ( |
17 | #================================================ |
18 | # TESTS FOR code2country |
19 | #================================================ |
20 | |
21 | #---- selection of examples which should all result in undef ----------- |
22 | '!defined code2country()', # no argument |
23 | '!defined code2country(undef)', # undef argument |
24 | '!defined code2country("zz")', # illegal code |
25 | '!defined code2country("ja")', # should be jp for country |
26 | |
27 | #---- some successful examples ----------------------------------------- |
28 | 'code2country("BO") eq "Bolivia"', |
29 | 'code2country("pk") eq "Pakistan"', |
30 | 'code2country("sn") eq "Senegal"', |
31 | 'code2country("us") eq "United States"', |
32 | 'code2country("ad") eq "Andorra"', # first in DATA segment |
33 | 'code2country("zw") eq "Zimbabwe"', # last in DATA segment |
34 | 'code2country("uk") eq "United Kingdom"', # normally "gb" |
35 | |
36 | #================================================ |
37 | # TESTS FOR country2code |
38 | #================================================ |
39 | |
40 | #---- selection of examples which should all result in undef ----------- |
41 | '!defined country2code()', # no argument |
42 | '!defined country2code(undef)', # undef argument |
43 | '!defined country2code("Banana")', # illegal country name |
44 | |
45 | #---- some successful examples ----------------------------------------- |
46 | 'country2code("japan") eq "jp"', |
47 | 'country2code("japan") ne "ja"', |
48 | 'country2code("Japan") eq "jp"', |
49 | 'country2code("United States") eq "us"', |
50 | 'country2code("United Kingdom") eq "uk"', |
51 | 'country2code("Andorra") eq "ad"', # first in DATA segment |
52 | 'country2code("Zimbabwe") eq "zw"', # last in DATA segment |
53 | ); |
54 | |
55 | print "1..", int(@TESTS), "\n"; |
56 | |
57 | $testid = 1; |
58 | foreach $test (@TESTS) |
59 | { |
60 | eval "print (($test) ? \"ok $testid\\n\" : \"not ok $testid\\n\" )"; |
61 | print "not ok $testid\n" if $@; |
62 | ++$testid; |
63 | } |
64 | |
65 | exit 0; |