3 # uk.t - tests for Locale::Country with "uk" aliases to "gb"
8 Locale::Country::alias_code('uk' => 'gb');
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,
14 #-----------------------------------------------------------------------
17 #================================================
18 # TESTS FOR code2country
19 #================================================
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
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"
36 #================================================
37 # TESTS FOR country2code
38 #================================================
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
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
55 print "1..", int(@TESTS), "\n";
58 foreach $test (@TESTS)
60 eval "print (($test) ? \"ok $testid\\n\" : \"not ok $testid\\n\" )";
61 print "not ok $testid\n" if $@;