Add test for multiline strings in .po files

This commit is contained in:
Kevin Everets 2013-05-03 11:30:22 -04:00 committed by Sebastian Celis
parent 63fd78f0bc
commit 51161194ed
3 changed files with 52 additions and 0 deletions

23
test/fixtures/en-2.po vendored Normal file
View file

@ -0,0 +1,23 @@
msgid ""
msgstr ""
"Language: en\n"
"X-Generator: Twine\n"
msgctxt "key1"
msgid "key1-english"
msgstr "key1-english"
msgctxt "key3"
msgid "key3-english"
msgstr ""
msgctxt "key4"
msgid "key4"
"multiline"
msgstr "A multi"
"line string\n"
"can occur"
msgctxt "key5"
msgid "A new string"
msgstr "A new string"

21
test/fixtures/test-output-9.txt vendored Normal file
View file

@ -0,0 +1,21 @@
[[Uncategorized]]
[key5]
en = A new string
[[My Strings]]
[key1]
en = key1-english
tags = tag1
comment = This is a comment
es = key1-spanish
fr = key1-french
[key2]
en = key2-english
tags = tag2
fr = key2-french
[key3]
en = key3-english
tags = tag1,tag2
es = key3-spanish
[key4]
en = A multiline string\ncan occur

View file

@ -84,6 +84,14 @@ class TwineTest < Test::Unit::TestCase
end
end
def test_consume_string_file_5
Dir.mktmpdir do |dir|
output_path = File.join(dir, 'strings.txt')
Twine::Runner.run(%W(consume-string-file test/fixtures/strings-1.txt test/fixtures/en-2.po -o #{output_path} -l en -a))
assert_equal(File.read('test/fixtures/test-output-9.txt'), File.read(output_path))
end
end
def test_generate_report_1
Twine::Runner.run(%w(generate-report test/fixtures/strings-1.txt))
end