test/tools/test_msgmerge.rb in gettext-3.1.9 vs test/tools/test_msgmerge.rb in gettext-3.2.0

- old
+ new

@@ -283,10 +283,22 @@ assert_true(merged_po.has_key?("hello")) assert_equal("bonjour", merged_po["hello"].msgstr) assert_equal("fuzzy", merged_po["hello"].flag) end + def test_fuzzy_matching_included_source + base_msgid = "hello" + new_msgid = base_msgid + ("!" * 10) + @po[base_msgid] = "bonjour" + @pot[new_msgid] = "" + merged_po = merge + + puts merged_po + assert_equal("bonjour", merged_po[new_msgid].msgstr) + assert_equal("fuzzy", merged_po[new_msgid].flag) + end + def test_merged_entry_from_fuzzy_entry @po["hello"] = generate_entry(:msgid => "hello", :msgstr => "bonjuor", :flag => "fuzzy") @@ -409,11 +421,11 @@ #: hello.rb:1 msgid "Hello" msgstr "" #: hello.rb:3 -msgid "Hello World" +msgid "Good-bye" msgstr "" EOP end def po_header(creation_date, revision_date) @@ -460,11 +472,11 @@ #: hello.rb:2 msgid "World" msgstr "Translated World" #: hello.rb:3 -msgid "Hello World" +msgid "Good-bye" msgstr "" EOP end end @@ -491,11 +503,11 @@ #, fuzzy msgid "World" msgstr "Translated World" #: hello.rb:3 -msgid "Hello World" +msgid "Good-bye" msgstr "" PO end end end @@ -512,29 +524,29 @@ #: hello.rb:2 msgid "World" msgstr "Translated World" #: hello.rb:3 -msgid "Hello World" +msgid "Good-bye" msgstr "" PO end def test_sort_output @msgmerge.run("--update", "--sort-output", @po_file_path, @pot_file_path) assert_equal(<<-PO, File.read(@po_file_path)) #{po_header(@pot_formatted_time, @po_formatted_time)} +#: hello.rb:3 +msgid "Good-bye" +msgstr "" + #: hello.rb:1 msgid "Hello" msgstr "" -#: hello.rb:3 -msgid "Hello World" -msgstr "" - #: hello.rb:2 msgid "World" msgstr "Translated World" PO end @@ -552,11 +564,11 @@ #: hello.rb:2 msgid "World" msgstr "Translated World" #: hello.rb:3 -msgid "Hello World" +msgid "Good-bye" msgstr "" PO end def test_sort_by_location @@ -572,29 +584,29 @@ #: hello.rb:2 msgid "World" msgstr "Translated World" #: hello.rb:3 -msgid "Hello World" +msgid "Good-bye" msgstr "" PO end def test_sort_by_msgid @msgmerge.run("--update", "--sort-by-msgid", @po_file_path, @pot_file_path) assert_equal(<<-PO, File.read(@po_file_path)) #{po_header(@pot_formatted_time, @po_formatted_time)} +#: hello.rb:3 +msgid "Good-bye" +msgstr "" + #: hello.rb:1 msgid "Hello" msgstr "" -#: hello.rb:3 -msgid "Hello World" -msgstr "" - #: hello.rb:2 msgid "World" msgstr "Translated World" PO end @@ -614,11 +626,11 @@ #: hello.rb:2 msgid "World" msgstr "Translated World" #: hello.rb:3 -msgid "Hello World" +msgid "Good-bye" msgstr "" PO end def test_no_location @@ -631,11 +643,11 @@ msgstr "" msgid "World" msgstr "Translated World" -msgid "Hello World" +msgid "Good-bye" msgstr "" PO end end @@ -645,20 +657,20 @@ #: hello.rb:1 msgid "Hello very long line! This line is very long. Yes! This line is very long! Very very long line!" msgstr "" #: hello.rb:3 -msgid "Hello World" +msgid "Good-bye" msgstr "" POT end def po_content <<-PO #: hello.rb:3 -msgid "Hello World" -msgstr "Translated Hello World. This translation is very long. Yes! Very long translation!!!" +msgid "Good-bye" +msgstr "Translated Good-bye. This translation is very long. Yes! Very long translation!!!" PO end def test_default @msgmerge.run("--update", @@ -669,14 +681,14 @@ "Hello very long line! This line is very long. Yes! This line is very long! Ver" "y very long line!" msgstr "" #: hello.rb:3 -msgid "Hello World" +msgid "Good-bye" msgstr "" -"Translated Hello World. This translation is very long. Yes! Very long translat" -"ion!!!" +"Translated Good-bye. This translation is very long. Yes! Very long translation" +"!!!" PO end def test_width @msgmerge.run("--update", @@ -688,14 +700,14 @@ "Hello very long line! This line is very long. Yes! This line is very l" "ong! Very very long line!" msgstr "" #: hello.rb:3 -msgid "Hello World" +msgid "Good-bye" msgstr "" -"Translated Hello World. This translation is very long. Yes! Very long " -"translation!!!" +"Translated Good-bye. This translation is very long. Yes! Very long tra" +"nslation!!!" PO end def test_no_wrap @msgmerge.run("--update", @@ -705,11 +717,11 @@ #: hello.rb:1 msgid "Hello very long line! This line is very long. Yes! This line is very long! Very very long line!" msgstr "" #: hello.rb:3 -msgid "Hello World" -msgstr "Translated Hello World. This translation is very long. Yes! Very long translation!!!" +msgid "Good-bye" +msgstr "Translated Good-bye. This translation is very long. Yes! Very long translation!!!" PO end end class TestFuzzyMatching < self