Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Cosimo Streppone
committed
Sep 3, 2012
1 parent
aa8d132
commit 82251eb
Showing
2 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#, fuzzy | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: 1.0\n" | ||
"Report-Msgid-Bugs-To: cosimo@opera.com\n" | ||
"POT-Creation-Date: 2012-09-03 14:03+0100\n" | ||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
"Language-Team: LANGUAGE <team@pledgebank.com>\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" | ||
|
||
#: test.html:1 | ||
#~ msgid "More info" | ||
#~ msgstr "" | ||
#~ "This is an obsolete string that appears to run over multiple lines and there is " | ||
#~ "nothing you can do to escape the simple fact that it does run over multiple lines." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
=head1 NAME | ||
t/RT40009.t | ||
=head1 DESCRIPTION | ||
Check that obsolete multiline msgstr entries are | ||
recognized and stored correctly, as per RT#40009: | ||
https://rt.cpan.org/Ticket/Display.html?id=40009 | ||
=cut | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use Test::More tests => 8; | ||
use File::Slurp; | ||
use Locale::PO; | ||
use Data::Dumper; | ||
|
||
my $file = "t/RT40009.po"; | ||
my $po = Locale::PO->load_file_asarray($file); | ||
ok $po, "loaded ${file} file"; | ||
|
||
my $out = $po->[0]->dump; | ||
ok $out, "dumped po object"; | ||
|
||
ok(Locale::PO->save_file_fromarray("${file}.out", $po), "save again to file"); | ||
ok -e "${file}.out", "the file now exists"; | ||
|
||
my $po_after_rt = Locale::PO->load_file_asarray("${file}.out"); | ||
ok $po_after_rt, "loaded ${file}.out file" | ||
and unlink "${file}.out"; | ||
|
||
# Check that our multiline obsolete msgstr is | ||
# still the same string, even if it might have changed | ||
# from multiple lines to single line internally | ||
|
||
# Old Locale::PO used to barf with "Strange line at ..." | ||
# See RT#40009, https://rt.cpan.org/Ticket/Display.html?id=40009 | ||
my $orig_entry = $po->[1]; | ||
my $new_entry = $po_after_rt->[1]; | ||
|
||
ok $new_entry->obsolete, "Entry is marked as obsolete"; | ||
|
||
is_deeply $orig_entry => $new_entry, | ||
"We have the same entry before and after a round trip"; | ||
|
||
is $new_entry->msgstr => | ||
q("This is an obsolete string that appears to run over multiple lines and there is nothing you can do to escape the simple fact that it does run over multiple lines."), | ||
"Multiline obsolete strings are conserved"; |