Skip to content

Commit

Permalink
[RT#66264] Test case for obsolete fuzzy strings
Browse files Browse the repository at this point in the history
Provided by Joshua Miller in the RT ticket.
  • Loading branch information
Cosimo Streppone committed Sep 3, 2012
1 parent 8a53e03 commit a44fbe9
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 0 deletions.
68 changes: 68 additions & 0 deletions t/fuzzy.pot
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,68 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: ENCODING\n"

# tests for handline fuzzy / old strings
#, fuzzy
#| msgid "Click Ok to continue."
msgid "Click OK to continue."
msgstr ""

#: cgi-bin/test.pl:6505
#, fuzzy
#| msgid "Response"
msgid "Add Response"
msgstr ""

#: cgi-bin/programGoals.pl:1200
#, fuzzy
#| msgid ""
#| "There are no bindings for the the Goal Group filter you chose. \n"
#| "If you need a binding added contact %1. All Goal Groups, \n"
#| "will still be displayed below."
msgid ""
"There are no bindings for the the Goal Group or GoalType Sets you chose.\n"
"If you need a binding added contact %1. All Goal Groups and GoalType Sets\n"
"will still be displayed below."
msgstr ""

#: cgi-bin/employeeProfile.pl:824
#, fuzzy
#| msgctxt "Date as in the noun, the time at which an event occcurs"
#| msgid "Date"
msgctxt "Date as in the noun, the time at which an event occurred"
msgid "Date"
msgstr ""

#, fuzzy
#| msgid "1 day"
#| msgid_plural "%n days"
msgctxt "Number of Days"
msgid "1 day"
msgid_plural "%n days"
msgstr[0] ""
msgstr[1] ""

#, fuzzy
#~| msgid "Other Fields"
#~ msgid "Other Skills"
#~ msgstr ""

#, fuzzy
#~| msgid ""
#~| "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do \n"
#~| "eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim \n"
#~| "ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut \n"
#~| "aliquip ex ea commodo consequat. Duis aute irure dolor in \n"
#~| "reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla \n"
#~| "pariatur. Excepteur sint occaecat cupidatat non proident, sunt in \n"
#~| "culpa qui officia deserunt mollit anim id est laborum."
#~ msgid "Lorem ipsum"
#~ msgstr ""

54 changes: 54 additions & 0 deletions t/fuzzy.t
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,54 @@
# $Id: fuzzy.t,v 1.1 2011/02/28 14:33:10 evdb Exp $
# Copyright 2005. Distributed under the same licence as Perl itself.
# Author: Joshua Miller <unrtst@cpan.org>

use strict;
use warnings;

use Test::More 'no_plan';
use File::Slurp;

use_ok 'Locale::PO';

my $pos = Locale::PO->load_file_asarray("t/fuzzy.pot");
ok $pos, "loaded fuzzy.pot file";

my $out = $pos->[0]->dump;
ok $out, "dumped po object";

ok Locale::PO->save_file_fromarray( "t/fuzzy.pot.out", $pos ), "save to file";
ok -e "t/fuzzy.pot.out", "the file now exists";

is(
read_file('t/fuzzy.pot'),
read_file('t/fuzzy.pot.out'),
"found no matches - good"
)
&& unlink 't/fuzzy.pot.out';

{ # Check that the fuzzy can be created in code.

my $po = Locale::PO->new(
-fuzzy_msgid => 'one test',
-fuzzy_msgid_plural => '%d tests',
-msgid => '%d test',
-msgid_plural => '%d tests',
-msgstr_n => { 0 => '%d TEST', 1 => '%d TESTS' },
);
ok $po, "object created.";

my $expected = join "\n", '#| msgid "one test"', '#| msgid_plural "%d tests"',
'msgid "%d test"', 'msgid_plural "%d tests"',
'msgstr[0] "%d TEST"', 'msgstr[1] "%d TESTS"', '', '';

is $po->dump, $expected, "check the output";

# try to edit the fuzzy in the code.

ok $po->fuzzy_msgid( 'one TeSt' ),
"change the value of a fuzzy msgid";

$expected =~ s/one test/one TeSt/;
is $po->dump, $expected, "check the output";

}

0 comments on commit a44fbe9

Please sign in to comment.