#94 cleaned up and shortened tests
This commit is contained in:
parent
4f6f65fdf8
commit
c28c820266
1 changed files with 13 additions and 20 deletions
|
@ -11,8 +11,8 @@ class TwineTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def teardown
|
||||
super
|
||||
FileUtils.remove_entry_secure @output_dir
|
||||
super
|
||||
end
|
||||
|
||||
def output_content
|
||||
|
@ -20,6 +20,7 @@ class TwineTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def execute(command)
|
||||
command += " -o #{@output_path}"
|
||||
Twine::Runner.run(command.split(" "))
|
||||
end
|
||||
|
||||
|
@ -36,49 +37,41 @@ end
|
|||
class ReferencesTest < TwineTest
|
||||
def test_consumption_preserves_references
|
||||
input = 'twine_value_reference.txt'
|
||||
execute "consume-string-file #{f input} #{f 'empty.xml'} -o #{@output_path} -l en"
|
||||
execute "consume-string-file #{f input} #{f 'empty.xml'} -l en"
|
||||
assert_equal content(input), output_content
|
||||
end
|
||||
|
||||
def test_consumption_does_not_add_unchanged_translation
|
||||
original = 'twine_value_reference.txt'
|
||||
FileUtils.copy fixture(original), @output_path
|
||||
|
||||
execute "consume-string-file #{@output_path} #{f 'same_value.xml'} -o #{@output_path} -l en"
|
||||
assert_equal content(original), output_content
|
||||
input = 'twine_value_reference.txt'
|
||||
execute "consume-string-file #{f input} #{f 'same_value.xml'} -l en"
|
||||
assert_equal content(input), output_content
|
||||
end
|
||||
|
||||
def test_consumption_adds_changed_translation
|
||||
FileUtils.copy fixture('twine_value_reference.txt'), @output_path
|
||||
|
||||
execute "consume-string-file #{@output_path} #{f 'different_value.xml'} -o #{@output_path} -l en"
|
||||
execute "consume-string-file #{f 'twine_value_reference.txt'} #{f 'different_value.xml'} -l en"
|
||||
assert_equal content('twine_updated_value.txt'), output_content
|
||||
end
|
||||
|
||||
def test_consuption_does_not_add_comment
|
||||
input = 'twine_comment_reference.txt'
|
||||
execute "consume-string-file #{f input} #{f 'empty.xml'} -o #{@output_path} -l en"
|
||||
execute "consume-string-file #{f input} #{f 'empty.xml'} -l en"
|
||||
assert_equal content(input), output_content
|
||||
end
|
||||
|
||||
def test_consumption_does_not_add_unchanged_comment
|
||||
original = 'twine_comment_reference.txt'
|
||||
FileUtils.copy fixture(original), @output_path
|
||||
|
||||
execute "consume-string-file #{@output_path} #{f 'same_comment.xml'} -o #{@output_path} -l en -c"
|
||||
assert_equal content(original), output_content
|
||||
input = 'twine_comment_reference.txt'
|
||||
execute "consume-string-file #{f input} #{f 'same_comment.xml'} -l en -c"
|
||||
assert_equal content(input), output_content
|
||||
end
|
||||
|
||||
def test_consumption_adds_changed_comment
|
||||
FileUtils.copy fixture('twine_comment_reference.txt'), @output_path
|
||||
|
||||
execute "consume-string-file #{@output_path} #{f 'different_comment.xml'} -o #{@output_path} -l en -c"
|
||||
execute "consume-string-file #{f 'twine_comment_reference.txt'} #{f 'different_comment.xml'} -l en -c"
|
||||
assert_equal content('twine_updated_comment.txt'), output_content
|
||||
end
|
||||
|
||||
def test_consumption_does_not_add_tags
|
||||
input = 'twine_tag_reference.txt'
|
||||
execute "consume-string-file #{f input} #{f 'empty.xml'} -o #{@output_path} -l en -c"
|
||||
execute "consume-string-file #{f input} #{f 'empty.xml'} -l en -c"
|
||||
assert_equal content(input), output_content
|
||||
end
|
||||
end
|
||||
|
|
Reference in a new issue