Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / lib / 5.8.0 / I18N / LangTags / test.pl
CommitLineData
86530b38
AT
1# Before `make install' is performed this script should be runnable with
2# `make test'. After `make install' it should work as `perl test.pl'
3
4######################### We start with some black magic to print on failure.
5require 5;
6 # Time-stamp: "2001-06-21 22:59:38 MDT"
7use strict;
8use Test;
9BEGIN { plan tests => 46 };
10BEGIN { ok 1 }
11use I18N::LangTags (':ALL');
12
13print "# Perl v$], I18N::LangTags v$I18N::LangTags::VERSION\n";
14
15ok !is_language_tag('');
16ok is_language_tag('fr');
17ok is_language_tag('fr-ca');
18ok is_language_tag('fr-CA');
19ok !is_language_tag('fr-CA-');
20ok !is_language_tag('fr_CA');
21ok is_language_tag('fr-ca-joual');
22ok !is_language_tag('frca');
23ok is_language_tag('nav');
24ok is_language_tag('nav-shiprock');
25ok !is_language_tag('nav-ceremonial'); # subtag too long
26ok !is_language_tag('x');
27ok !is_language_tag('i');
28ok is_language_tag('i-borg'); # NB: fictitious tag
29ok is_language_tag('x-borg');
30ok is_language_tag('x-borg-prot5123');
31ok same_language_tag('x-borg-prot5123', 'i-BORG-Prot5123' );
32ok !same_language_tag('en', 'en-us' );
33
34ok 0 == similarity_language_tag('en-ca', 'fr-ca');
35ok 1 == similarity_language_tag('en-ca', 'en-us');
36ok 2 == similarity_language_tag('en-us-southern', 'en-us-western');
37ok 2 == similarity_language_tag('en-us-southern', 'en-us');
38
39ok grep $_ eq 'hi', panic_languages('kok');
40ok grep $_ eq 'en', panic_languages('x-woozle-wuzzle');
41ok ! grep $_ eq 'mr', panic_languages('it');
42ok grep $_ eq 'es', panic_languages('it');
43ok grep $_ eq 'it', panic_languages('es');
44
45
46print "# Now the ::List tests...\n";
47use I18N::LangTags::List;
48foreach my $lt (qw(
49 en
50 en-us
51 en-kr
52 el
53 elx
54 i-mingo
55 i-mingo-tom
56 x-mingo-tom
57 it
58 it-it
59 it-IT
60 it-FR
61 yi
62 ji
63 cre-syllabic
64 cre-syllabic-western
65 cre-western
66 cre-latin
67)) {
68 my $name = I18N::LangTags::List::name($lt);
69 if($name) {
70 ok(1);
71 print "# $lt -> $name\n";
72 } else {
73 ok(0);
74 print "# Failed lookup on $lt\n";
75 }
76}
77
78print "# So there!\n";
79