Oops. Forgot to add the new test in I18N::LangTags 0.35
Nicholas Clark [Sun, 31 Oct 2004 11:07:57 +0000 (11:07 +0000)]
p4raw-id: //depot/perl@23442

lib/I18N/LangTags/t/20_locales.t [new file with mode: 0644]

diff --git a/lib/I18N/LangTags/t/20_locales.t b/lib/I18N/LangTags/t/20_locales.t
new file mode 100644 (file)
index 0000000..ae04812
--- /dev/null
@@ -0,0 +1,38 @@
+require 5;
+ # Time-stamp: "2004-10-06 23:07:06 ADT"
+use strict;
+use Test;
+BEGIN { plan tests => 22 };
+BEGIN { ok 1 }
+use I18N::LangTags (':ALL');
+
+print "# Perl v$], I18N::LangTags v$I18N::LangTags::VERSION\n";
+print "#  Loaded from ", $INC{'I18N/LangTags.pm'} || "??", "\n";
+
+ok lc locale2language_tag('en'),    'en';
+ok lc locale2language_tag('en_US'),    'en-us';
+ok lc locale2language_tag('en_US.ISO8859-1'),    'en-us';
+ok lc(locale2language_tag('C')||''),    '';
+ok lc(locale2language_tag('POSIX')||''), '';
+
+
+ok lc locale2language_tag('eu_mt'),           'eu-mt';
+ok lc locale2language_tag('eu'),              'eu';
+ok lc locale2language_tag('it'),              'it';
+ok lc locale2language_tag('it_IT'),           'it-it';
+ok lc locale2language_tag('it_IT.utf8'),      'it-it';
+ok lc locale2language_tag('it_IT.utf8@euro'), 'it-it';
+ok lc locale2language_tag('it_IT@euro'),      'it-it';
+
+
+ok lc locale2language_tag('zh_CN.gb18030'), 'zh-cn';
+ok lc locale2language_tag('zh_CN.gbk'),     'zh-cn';
+ok lc locale2language_tag('zh_CN.utf8'),    'zh-cn';
+ok lc locale2language_tag('zh_HK'),         'zh-hk';
+ok lc locale2language_tag('zh_HK.utf8'),    'zh-hk';
+ok lc locale2language_tag('zh_TW'),         'zh-tw';
+ok lc locale2language_tag('zh_TW.euctw'),   'zh-tw';
+ok lc locale2language_tag('zh_TW.utf8'),    'zh-tw';
+
+print "# So there!\n";
+ok 1;