test/tools/test_msgmerge.rb in gettext-2.3.5 vs test/tools/test_msgmerge.rb in gettext-2.3.6
- old
+ new
@@ -132,11 +132,17 @@
po = GetText::Tools::MsgMerge::PoData.new
po.set_comment("", header_entry_comment)
po[""] = header_entry
po.set_comment(:last, obsolete_comment)
- expected_obsolete_comment = obsolete_comment.gsub(/^/, "#~ ").chomp
+ expected_obsolete_comment = <<-EOC
+# test.rb:10
+#~ msgid "Hello"
+#~ msgstr "Salut"
+EOC
+ expected_obsolete_comment = expected_obsolete_comment.chomp
+
expected_po = <<EOP
#{header_entry_comment}
msgid \"\"
msgstr \"#{header_entry}\"
@@ -305,10 +311,21 @@
assert_equal("bonjour", merged_po["hello"].msgstr)
assert_equal("il", merged_po["he"].msgstr)
end
+ def test_existing_obsolete_entry
+ @po["hello"] = "bonjour"
+ @po[:last] = generate_entry(:msgid => :last,
+ :comment => "#~ obsolete_entry")
+ @pot["hello"] = "bonjour"
+ merged_po = @merger.merge(@po, @pot)
+
+ assert_equal("bonjour", merged_po["hello"].msgstr)
+ assert_nil(merged_po[:last])
+ end
+
def test_different_msgstr
@po["hello"] = "salut"
@pot["hello"] = "bonjour"
merged_po = @merger.merge(@po, @pot)
@@ -500,9 +517,10 @@
entry.previous = options[:previous]
entry.msgctxt = msgctxt
entry.msgid = options[:msgid]
entry.msgid_plural = msgid_plural
entry.msgstr = options[:msgstr]
+ entry.comment = options[:comment]
entry
end
end
class TestMerge < self