test/tools/test_msgcat.rb in gettext-3.1.0 vs test/tools/test_msgcat.rb in gettext-3.1.1
- old
+ new
@@ -378,10 +378,39 @@
msgid "Hello"
msgstr "Bonjour2"
PO
end
end
+
+ class TestNoAllComments < self
+ def setup
+ @po_fuzzy1 = <<-PO
+#, fuzzy
+msgid "Hello"
+msgstr "Bonjour1"
+ PO
+
+ @po_fuzzy2 = <<-PO
+#, fuzzy
+msgid "Hello"
+msgstr "Bonjour2"
+ PO
+ end
+
+ def test_default
+ pos = [@po_fuzzy1, @po_fuzzy2]
+ assert_equal(<<-PO, run_msgcat(pos, "--no-all-comments"))
+msgid "Hello"
+msgstr "Bonjour1"
+ PO
+ end
+
+ def test_no_fuzzy
+ pos = [@po_fuzzy1, @po_fuzzy2]
+ assert_equal("", run_msgcat(pos, "--no-all-comments", "--no-fuzzy"))
+ end
+ end
end
class TestWarning < self
def setup
@po_fuzzy = <<-PO
@@ -402,23 +431,57 @@
end
end
class TestObsoleteEntries < self
def setup
- @po_fuzzy = <<-PO
+ @po_obsolete = <<-PO
#~ msgid "Hello World"
#~ msgstr "Bonjour"
PO
end
def test_default
- assert_equal(<<-PO, run_msgcat([@po_fuzzy]))
+ assert_equal(<<-PO, run_msgcat([@po_obsolete]))
#~ msgid "Hello World"
#~ msgstr "Bonjour"
PO
end
def test_no_obsolete_entries
- assert_equal("", run_msgcat([@po_fuzzy], "--no-obsolete-entries"))
+ assert_equal("", run_msgcat([@po_obsolete], "--no-obsolete-entries"))
+ end
+ end
+
+ class TestRemoveHeaderField < self
+ def setup
+ @po_header = <<-PO
+msgid ""
+msgstr ""
+"Project-Id-Version: gettext 3.0.0\\n"
+"POT-Creation-Date: 2014-02-23 19:02+0900\\n"
+"Language: ja\\n"
+ PO
+ end
+
+ def test_one
+ options = ["--remove-header-field=POT-Creation-Date"]
+ assert_equal(<<-PO, run_msgcat([@po_header], *options))
+msgid ""
+msgstr ""
+"Project-Id-Version: gettext 3.0.0\\n"
+"Language: ja\\n"
+ PO
+ end
+
+ def test_multiple
+ options = [
+ "--remove-header-field=Project-Id-Version",
+ "--remove-header-field=POT-Creation-Date",
+ ]
+ assert_equal(<<-PO, run_msgcat([@po_header], *options))
+msgid ""
+msgstr ""
+"Language: ja\\n"
+ PO
end
end
end