Update Locale::Codes to 3.12
[p5sagit/p5-mst-13.2.git] / cpan / Locale-Codes / t / language2code.t
1 #!/usr/bin/perl -w
2
3 require 5.002;
4
5 $runtests=shift(@ARGV);
6 if ( -f "t/testfunc.pl" ) {
7   require "t/testfunc.pl";
8   $dir="./lib";
9   $tdir="t";
10 } elsif ( -f "testfunc.pl" ) {
11   require "testfunc.pl";
12   $dir="../lib";
13   $tdir=".";
14 } else {
15   die "ERROR: cannot find testfunc.pl\n";
16 }
17
18 unshift(@INC,$dir);
19 use Locale::Language;
20
21 %type = ( "LOCALE_CODE_ALPHA_2" => LOCALE_CODE_ALPHA_2,
22           "LOCALE_CODE_ALPHA_3" => LOCALE_CODE_ALPHA_3,
23           "LOCALE_CODE_TERM"    => LOCALE_CODE_TERM,
24         );
25
26 sub test {
27    my(@test) = @_;
28    $test[1]  = $type{$test[1]}
29      if (@test == 2  &&  $test[1]  &&  exists $type{$test[1]});
30    return language2code(@test);
31 }
32
33 $tests = "
34
35 Banana ~ _undef_
36
37 ~ _undef_
38
39 _undef_ ~ _undef_
40
41 Afar
42    ~
43    aa
44
45 ESTONIAN
46    ~
47    et
48
49 French
50    ~
51    fr
52
53 Greek
54    ~
55    el
56
57 Japanese
58    ~
59    ja
60
61 Zulu
62    ~
63    zu
64
65 english
66    ~
67    en
68
69 japanese
70    ~
71    ja
72
73 ";
74
75 print "language2code...\n";
76 test_Func(\&test,$tests,$runtests);
77
78 1;
79 # Local Variables:
80 # mode: cperl
81 # indent-tabs-mode: nil
82 # cperl-indent-level: 3
83 # cperl-continued-statement-offset: 2
84 # cperl-continued-brace-offset: 0
85 # cperl-brace-offset: 0
86 # cperl-brace-imaginary-offset: 0
87 # cperl-label-offset: -2
88 # End: