summaryrefslogtreecommitdiff
path: root/cpan/Locale-Maketext-Simple/t
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-10-02 18:21:32 +0100
committerNicholas Clark <nick@ccl4.org>2009-10-02 18:21:32 +0100
commit8de4179424c1ce7de2d7779c01e54e3e2e372911 (patch)
treed7670225acacf39ef03e5a896775d5db82d8646e /cpan/Locale-Maketext-Simple/t
parent8b88b2b2a83b118e358c4d04557659e32d47c01b (diff)
downloadperl-8de4179424c1ce7de2d7779c01e54e3e2e372911.tar.gz
Move Locale::Maketext::Simple from dist/ to cpan/
My mistake - it should always have been here, as the canonical upstream is Best Practical's svn.
Diffstat (limited to 'cpan/Locale-Maketext-Simple/t')
-rw-r--r--cpan/Locale-Maketext-Simple/t/0-signature.t27
-rwxr-xr-xcpan/Locale-Maketext-Simple/t/1-basic.t26
-rwxr-xr-xcpan/Locale-Maketext-Simple/t/2-load_po_without_i_default.t30
-rwxr-xr-xcpan/Locale-Maketext-Simple/t/3-load_po_with_i_default.t31
-rw-r--r--cpan/Locale-Maketext-Simple/t/po_with_i_default/en.po30
-rw-r--r--cpan/Locale-Maketext-Simple/t/po_with_i_default/fr.po30
-rw-r--r--cpan/Locale-Maketext-Simple/t/po_with_i_default/i_default.po30
-rw-r--r--cpan/Locale-Maketext-Simple/t/po_without_i_default/en.po30
-rw-r--r--cpan/Locale-Maketext-Simple/t/po_without_i_default/fr.po30
9 files changed, 264 insertions, 0 deletions
diff --git a/cpan/Locale-Maketext-Simple/t/0-signature.t b/cpan/Locale-Maketext-Simple/t/0-signature.t
new file mode 100644
index 0000000000..c70c4a3cca
--- /dev/null
+++ b/cpan/Locale-Maketext-Simple/t/0-signature.t
@@ -0,0 +1,27 @@
+#!/usr/bin/perl
+
+use strict;
+print "1..1\n";
+
+if (!$ENV{TEST_SIGNATURE}) {
+ print "ok 1 # skip set the environment variable TEST_SIGNATURE to enable this test\n";
+}
+elsif (!-s 'SIGNATURE') {
+ print "ok 1 # skip No signature file found\n";
+}
+elsif (!eval { require Module::Signature; 1 }) {
+ print "ok 1 # skip ",
+ "Next time around, consider install Module::Signature, ",
+ "so you can verify the integrity of this distribution.\n";
+}
+elsif (!eval { require Socket; Socket::inet_aton('pgp.mit.edu') }) {
+ print "ok 1 # skip ",
+ "Cannot connect to the keyserver\n";
+}
+else {
+ (Module::Signature::verify() == Module::Signature::SIGNATURE_OK())
+ or print "not ";
+ print "ok 1 # Valid signature\n";
+}
+
+__END__
diff --git a/cpan/Locale-Maketext-Simple/t/1-basic.t b/cpan/Locale-Maketext-Simple/t/1-basic.t
new file mode 100755
index 0000000000..91d033b795
--- /dev/null
+++ b/cpan/Locale-Maketext-Simple/t/1-basic.t
@@ -0,0 +1,26 @@
+use strict;
+use Test;
+
+BEGIN {
+ plan tests => 9;
+ $INC{'Locale/Maketext/Lexicon.pm'} = __FILE__;
+ $Locale::Maketext::Lexicon::VERSION = 0;
+}
+
+use Locale::Maketext::Simple;
+ok(Locale::Maketext::Simple->VERSION);
+ok(loc("Just [_1] Perl [_2]", qw(another hacker)), "Just another Perl hacker");
+
+{
+ local $^W; # shuts up 'redefined' warnings
+ Locale::Maketext::Simple->reload_loc;
+ Locale::Maketext::Simple->import(Style => 'gettext');
+}
+
+ok(loc("Just %1 Perl %2", qw(another hacker)), "Just another Perl hacker");
+ok(loc_lang('fr'));
+ok(loc("Just %quant(%1,Perl hacker)", 1), "Just 1 Perl hacker");
+ok(loc("Just %quant(%1,Perl hacker)", 2), "Just 2 Perl hackers");
+ok(loc("Just %quant(%1,Mad skill,Mad skillz)", 3), "Just 3 Mad skillz");
+ok(loc("Error %tense(%1,present)", 'uninstall'), "Error uninstalling");
+ok(loc("Error %tense(uninstall,present)"), "Error uninstalling");
diff --git a/cpan/Locale-Maketext-Simple/t/2-load_po_without_i_default.t b/cpan/Locale-Maketext-Simple/t/2-load_po_without_i_default.t
new file mode 100755
index 0000000000..47a982307e
--- /dev/null
+++ b/cpan/Locale-Maketext-Simple/t/2-load_po_without_i_default.t
@@ -0,0 +1,30 @@
+use strict;
+use Test::More;
+use FindBin qw($Bin);
+
+use Locale::Maketext::Simple (
+ Path => "$Bin/po_without_i_default",
+ Style => "gettext",
+);
+
+eval {
+ require Locale::Maketext::Lexicon;
+ die unless Locale::Maketext::Lexicon->VERSION(0.20);
+ require File::Spec;
+};
+if ($@) {
+ plan skip_all => 'No soft dependencies, i_default will not work';
+ exit 0;
+}
+
+plan tests => 5;
+
+loc_lang("en");
+is(loc("Not a lexicon key"), "Not a lexicon key", "Not a lexicon key");
+is(loc("I have got %1 alerts", 65), "I have got 65 alerts", "Got auto key" );
+is(loc("I have acknowledged %1 alerts", 83), "Yo dude, I've been working on these 83 alerts", "Got translation");
+
+loc_lang("fr");
+is(loc("system.messages.arbitrary.unique.lexicon.key"), "system.messages.arbitrary.unique.lexicon.key", "No translation" );
+is(loc("I have got %1 alerts", "red"), "Mon Francais red, c'est terrible", "French translated" );
+
diff --git a/cpan/Locale-Maketext-Simple/t/3-load_po_with_i_default.t b/cpan/Locale-Maketext-Simple/t/3-load_po_with_i_default.t
new file mode 100755
index 0000000000..a8807106dd
--- /dev/null
+++ b/cpan/Locale-Maketext-Simple/t/3-load_po_with_i_default.t
@@ -0,0 +1,31 @@
+use strict;
+use Test::More;
+use FindBin qw($Bin);
+
+use Locale::Maketext::Simple (
+ Path => "$Bin/po_with_i_default",
+ Style => "gettext",
+);
+
+eval {
+ require Locale::Maketext::Lexicon;
+ die unless Locale::Maketext::Lexicon->VERSION(0.20);
+ require File::Spec;
+};
+if ($@) {
+ plan skip_all => 'No soft dependencies, i_default will not work';
+ exit 0;
+}
+
+plan tests => 6;
+
+loc_lang("en");
+is(loc("Not a lexicon key"), "Not a lexicon key", "Not a lexicon key");
+is(loc("I have got %1 alerts", "hot"), "Maybe it's because I'm a hot Londoner, that I love London tawn", "Got auto key" );
+is(loc("I have acknowledged %1 alerts", 83), "Yo dude, I've been working on these 83 alerts", "Got translation still in en");
+is(loc("system.messages.arbitrary.unique.lexicon.key"), "This is the default message", "Used i_default because not set in en");
+
+loc_lang("fr");
+is(loc("system.messages.arbitrary.unique.lexicon.key"), "This is the default message", "Translated from i_default");
+is(loc("I have got %1 alerts", "red"), "Mon Francais red, c'est terrible", "French translated" );
+
diff --git a/cpan/Locale-Maketext-Simple/t/po_with_i_default/en.po b/cpan/Locale-Maketext-Simple/t/po_with_i_default/en.po
new file mode 100644
index 0000000000..0d80b92ef5
--- /dev/null
+++ b/cpan/Locale-Maketext-Simple/t/po_with_i_default/en.po
@@ -0,0 +1,30 @@
+# Locale Maketext Simple language translations
+# Copyright (C) All Perl Hackers everywhere
+# Ton Voon <ton.voon@opsera.com>, 2009.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Locale Maketext Simple\n"
+"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"PO-Revision-Date: 2009-06-09 14:10+0000\n"
+"Last-Translator: Ton Voon <ton.voon@opsera.com>\n"
+"Language-Team: English <en@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. $alerts
+#: lib/Opsview/Web/Controller/Root.pm:492
+msgid "I have got %1 alerts"
+msgstr ""
+
+#. $acknowledged
+#: lib/Opsview/Web/Controller/Root.pm:492
+msgid "I have acknowledged %1 alerts"
+msgstr "Yo dude, I've been working on these %1 alerts"
+
+#. $acknowledged
+#: lib/Opsview/Web/Controller/Root.pm:492
+msgid "system.messages.arbitrary.unique.lexicon.key"
+msgstr ""
+
diff --git a/cpan/Locale-Maketext-Simple/t/po_with_i_default/fr.po b/cpan/Locale-Maketext-Simple/t/po_with_i_default/fr.po
new file mode 100644
index 0000000000..8ecfbf761a
--- /dev/null
+++ b/cpan/Locale-Maketext-Simple/t/po_with_i_default/fr.po
@@ -0,0 +1,30 @@
+# Locale Maketext Simple language translations
+# Copyright (C) All Perl Hackers everywhere
+# Ton Voon <ton.voon@opsera.com>, 2009.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Locale Maketext Simple\n"
+"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"PO-Revision-Date: 2009-06-09 14:10+0000\n"
+"Last-Translator: Ton Voon <ton.voon@opsera.com>\n"
+"Language-Team: French <fr@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. $alerts
+#: lib/Opsview/Web/Controller/Root.pm:492
+msgid "I have got %1 alerts"
+msgstr "Mon Francais %1, c'est terrible"
+
+#. $acknowledged
+#: lib/Opsview/Web/Controller/Root.pm:492
+msgid "I have acknowledged %1 alerts"
+msgstr ""
+
+#. $acknowledged
+#: lib/Opsview/Web/Controller/Root.pm:492
+msgid "system.messages.arbitrary.unique.lexicon.key"
+msgstr ""
+
diff --git a/cpan/Locale-Maketext-Simple/t/po_with_i_default/i_default.po b/cpan/Locale-Maketext-Simple/t/po_with_i_default/i_default.po
new file mode 100644
index 0000000000..7327298688
--- /dev/null
+++ b/cpan/Locale-Maketext-Simple/t/po_with_i_default/i_default.po
@@ -0,0 +1,30 @@
+# Locale Maketext Simple language translations
+# Copyright (C) All Perl Hackers everywhere
+# Ton Voon <ton.voon@opsera.com>, 2009.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Locale Maketext Simple\n"
+"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"PO-Revision-Date: 2009-06-09 14:10+0000\n"
+"Last-Translator: Ton Voon <ton.voon@opsera.com>\n"
+"Language-Team: English <en@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. $alerts
+#: lib/Opsview/Web/Controller/Root.pm:492
+msgid "I have got %1 alerts"
+msgstr "Maybe it's because I'm a %1 Londoner, that I love London tawn"
+
+#. $acknowledged
+#: lib/Opsview/Web/Controller/Root.pm:492
+msgid "I have acknowledged %1 alerts"
+msgstr "In idefault instead of en"
+
+#. $acknowledged
+#: lib/Opsview/Web/Controller/Root.pm:492
+msgid "system.messages.arbitrary.unique.lexicon.key"
+msgstr "This is the default message"
+
diff --git a/cpan/Locale-Maketext-Simple/t/po_without_i_default/en.po b/cpan/Locale-Maketext-Simple/t/po_without_i_default/en.po
new file mode 100644
index 0000000000..0d80b92ef5
--- /dev/null
+++ b/cpan/Locale-Maketext-Simple/t/po_without_i_default/en.po
@@ -0,0 +1,30 @@
+# Locale Maketext Simple language translations
+# Copyright (C) All Perl Hackers everywhere
+# Ton Voon <ton.voon@opsera.com>, 2009.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Locale Maketext Simple\n"
+"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"PO-Revision-Date: 2009-06-09 14:10+0000\n"
+"Last-Translator: Ton Voon <ton.voon@opsera.com>\n"
+"Language-Team: English <en@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. $alerts
+#: lib/Opsview/Web/Controller/Root.pm:492
+msgid "I have got %1 alerts"
+msgstr ""
+
+#. $acknowledged
+#: lib/Opsview/Web/Controller/Root.pm:492
+msgid "I have acknowledged %1 alerts"
+msgstr "Yo dude, I've been working on these %1 alerts"
+
+#. $acknowledged
+#: lib/Opsview/Web/Controller/Root.pm:492
+msgid "system.messages.arbitrary.unique.lexicon.key"
+msgstr ""
+
diff --git a/cpan/Locale-Maketext-Simple/t/po_without_i_default/fr.po b/cpan/Locale-Maketext-Simple/t/po_without_i_default/fr.po
new file mode 100644
index 0000000000..8ecfbf761a
--- /dev/null
+++ b/cpan/Locale-Maketext-Simple/t/po_without_i_default/fr.po
@@ -0,0 +1,30 @@
+# Locale Maketext Simple language translations
+# Copyright (C) All Perl Hackers everywhere
+# Ton Voon <ton.voon@opsera.com>, 2009.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Locale Maketext Simple\n"
+"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"PO-Revision-Date: 2009-06-09 14:10+0000\n"
+"Last-Translator: Ton Voon <ton.voon@opsera.com>\n"
+"Language-Team: French <fr@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. $alerts
+#: lib/Opsview/Web/Controller/Root.pm:492
+msgid "I have got %1 alerts"
+msgstr "Mon Francais %1, c'est terrible"
+
+#. $acknowledged
+#: lib/Opsview/Web/Controller/Root.pm:492
+msgid "I have acknowledged %1 alerts"
+msgstr ""
+
+#. $acknowledged
+#: lib/Opsview/Web/Controller/Root.pm:492
+msgid "system.messages.arbitrary.unique.lexicon.key"
+msgstr ""
+