This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade to Locale::Codes 2.02.
[perl5.git] / lib / Locale / Codes / t / uk.t
CommitLineData
47a334e9
JH
1#!./perl
2#
3# uk.t - tests for Locale::Country with "uk" aliases to "gb"
4#
5
a8135056
JH
6BEGIN {
7 chdir 't' if -d 't';
8 @INC = '../lib';
9}
10
47a334e9
JH
11use Locale::Country;
12
917211f5 13Locale::Country::alias_code('uk' => 'gb');
47a334e9
JH
14
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,
18# otherwise "ok N".
19#-----------------------------------------------------------------------
20@TESTS =
21(
22 #================================================
23 # TESTS FOR code2country
24 #================================================
25
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
31
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"
40
41 #================================================
42 # TESTS FOR country2code
43 #================================================
44
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
49
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
58);
59
60print "1..", int(@TESTS), "\n";
61
62$testid = 1;
63foreach $test (@TESTS)
64{
65 eval "print (($test) ? \"ok $testid\\n\" : \"not ok $testid\\n\" )";
66 print "not ok $testid\n" if $@;
67 ++$testid;
68}
69
70exit 0;