3 # uk.t - tests for Locale::Country with "uk" aliases to "gb"
13 Locale::Country::_alias_code('uk' => 'gb');
15 #-----------------------------------------------------------------------
16 # This is an array of tests. Each test is eval'd as an expression.
17 # If it evaluates to FALSE, then "not ok N" is printed for the test,
19 #-----------------------------------------------------------------------
22 #================================================
23 # TESTS FOR code2country
24 #================================================
26 #---- selection of examples which should all result in undef -----------
27 '!defined code2country()', # no argument
28 '!defined code2country(undef)', # undef argument
29 '!defined code2country("zz")', # illegal code
30 '!defined code2country("ja")', # should be jp for country
32 #---- some successful examples -----------------------------------------
33 'code2country("BO") eq "Bolivia"',
34 'code2country("pk") eq "Pakistan"',
35 'code2country("sn") eq "Senegal"',
36 'code2country("us") eq "United States"',
37 'code2country("ad") eq "Andorra"', # first in DATA segment
38 'code2country("zw") eq "Zimbabwe"', # last in DATA segment
39 'code2country("uk") eq "United Kingdom"', # normally "gb"
41 #================================================
42 # TESTS FOR country2code
43 #================================================
45 #---- selection of examples which should all result in undef -----------
46 '!defined country2code()', # no argument
47 '!defined country2code(undef)', # undef argument
48 '!defined country2code("Banana")', # illegal country name
50 #---- some successful examples -----------------------------------------
51 'country2code("japan") eq "jp"',
52 'country2code("japan") ne "ja"',
53 'country2code("Japan") eq "jp"',
54 'country2code("United States") eq "us"',
55 'country2code("United Kingdom") eq "uk"',
56 'country2code("Andorra") eq "ad"', # first in DATA segment
57 'country2code("Zimbabwe") eq "zw"', # last in DATA segment
60 print "1..", int(@TESTS), "\n";
63 foreach $test (@TESTS)
65 eval "print (($test) ? \"ok $testid\\n\" : \"not ok $testid\\n\" )";
66 print "not ok $testid\n" if $@;