Added test for base folder resolved to developer_language option value

This commit is contained in:
Philippe Auriach 2017-10-13 11:49:56 +02:00
parent 21fdd84682
commit f5af8cf670

View file

@ -19,7 +19,7 @@ class FormatterTest < TwineTest
@empty_twine_file = Twine::TwineFile.new
@formatter = formatter_class.new
@formatter.twine_file = @empty_twine_file
@formatter.options = { consume_all: true, consume_comments: true }
@formatter.options = { consume_all: true, consume_comments: true, developer_language: 'en' }
end
def assert_translations_read_correctly
@ -39,7 +39,7 @@ end
class TestAndroidFormatter < FormatterTest
def setup
super Twine::Formatters::Android
@escape_test_values = {
'this & that' => 'this &amp; that',
'this < that' => 'this &lt; that',
@ -193,6 +193,16 @@ class TestAppleFormatter < FormatterTest
assert_file_contents_read_correctly
end
def test_deducts_language_from_resource_folder
language = %w(en de fr).sample
assert_equal language, @formatter.determine_language_given_path("#{language}.lproj/Localizable.strings")
end
def test_deducts_base_language_from_resource_folder
#from options developer_language = 'en'
assert_equal 'en', @formatter.determine_language_given_path('Base.lproj/Localizations.strings')
end
def test_reads_quoted_keys
@formatter.read StringIO.new('"key" = "value"'), 'en'
assert_equal 'value', @empty_twine_file.definitions_by_key['key'].translations['en']