This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Global executable bit cleanup
[perl5.git] / cpan / Locale-Codes / t / language2code.t
CommitLineData
f768f60b
S
1#!/usr/bin/perl -w
2
3require 5.002;
4
5$runtests=shift(@ARGV);
6if ( -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
18unshift(@INC,$dir);
19use 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
26sub 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
35Banana ~ _undef_
36
37~ _undef_
38
39_undef_ ~ _undef_
40
41Afar
42 ~
43 aa
44
45ESTONIAN
46 ~
47 et
48
49French
50 ~
51 fr
52
53Greek
54 ~
55 el
56
57Japanese
58 ~
59 ja
60
61Zulu
62 ~
63 zu
64
65english
66 ~
67 en
68
69japanese
70 ~
71 ja
72
73";
74
75print "language2code...\n";
76test_Func(\&test,$tests,$runtests);
77
781;
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: