Merge pull request from sebastianludwig/test_improvements

Test improvements
This commit is contained in:
Sebastian Celis 2016-05-03 15:54:14 -05:00
commit 50b1e90f8f
15 changed files with 50 additions and 52 deletions

View file

@ -1,6 +1,6 @@
require 'twine_test_case'
require 'twine_test'
class CommandTestCase < TwineTestCase
class CommandTest < TwineTest
def prepare_mock_formatter(formatter_class)
twine_file = Twine::TwineFile.new
twine_file.language_codes.concat KNOWN_LANGUAGES

View file

@ -1,7 +1,7 @@
require 'twine_test_case'
require 'twine_test'
class TestAbstractFormatter < TwineTestCase
class SetTranslation < TwineTestCase
class TestAbstractFormatter < TwineTest
class SetTranslation < TwineTest
def setup
super
@ -76,7 +76,7 @@ class TestAbstractFormatter < TwineTestCase
end
end
class ValueReference < TwineTestCase
class ValueReference < TwineTest
def setup
super
@ -104,7 +104,7 @@ class TestAbstractFormatter < TwineTestCase
end
end
class SetComment < TwineTestCase
class SetComment < TwineTest
def setup
super
@ -133,7 +133,7 @@ class TestAbstractFormatter < TwineTestCase
end
end
class CommentReference < TwineTestCase
class CommentReference < TwineTest
def setup
super

View file

@ -1,6 +1,6 @@
require 'twine_test_case'
require 'twine_test'
class CLITestCase < TwineTestCase
class CLITest < TwineTest
def setup
super
@ -13,7 +13,7 @@ class CLITestCase < TwineTestCase
@options = Twine::CLI::parse command.split
end
class TestValidateTwineFile < CLITestCase
class TestValidateTwineFile < CLITest
def test_command
parse "validate-twine-file #{@twine_file_path}"
@ -39,7 +39,7 @@ class CLITestCase < TwineTestCase
end
end
class TestGenerateLocalizationFile < CLITestCase
class TestGenerateLocalizationFile < CLITest
def test_command
parse "generate-localization-file #{@twine_file_path} #{@output_path}"
@ -72,7 +72,7 @@ class CLITestCase < TwineTestCase
end
end
class TestGenerateAllLocalizationFiles < CLITestCase
class TestGenerateAllLocalizationFiles < CLITest
def test_command
parse "generate-all-localization-files #{@twine_file_path} #{@output_dir}"
@ -99,7 +99,7 @@ class CLITestCase < TwineTestCase
end
end
class TestConsumeLocalizationFile < CLITestCase
class TestConsumeLocalizationFile < CLITest
def test_command
parse "consume-localization-file #{@twine_file_path} #{@input_path}"
@ -127,7 +127,7 @@ class CLITestCase < TwineTestCase
end
end
class TestConsumeAllLocalizationFiles < CLITestCase
class TestConsumeAllLocalizationFiles < CLITest
def test_command
parse "consume-all-localization-files #{@twine_file_path} #{@input_dir}"
@ -149,7 +149,7 @@ class CLITestCase < TwineTestCase
end
end
class TestGenerateLocDrop < CLITestCase
class TestGenerateLocDrop < CLITest
def test_command
parse "generate-loc-drop #{@twine_file_path} #{@output_path} --format apple"
@ -182,7 +182,7 @@ class CLITestCase < TwineTestCase
end
end
class TestConsumeLocDrop < CLITestCase
class TestConsumeLocDrop < CLITest
def test_command
parse "consume-loc-drop #{@twine_file_path} #{@input_path}"
@ -204,7 +204,7 @@ class CLITestCase < TwineTestCase
end
end
class TestParameters < CLITestCase
class TestParameters < CLITest
def parse_with(parameter)
parse 'validate-twine-file input.txt ' + parameter
end

View file

@ -1,6 +1,6 @@
require 'command_test_case'
require 'command_test'
class TestConsumeLocDrop < CommandTestCase
class TestConsumeLocDrop < CommandTest
def setup
super

View file

@ -1,6 +1,6 @@
require 'command_test_case'
require 'command_test'
class TestConsumeLocalizationFile < CommandTestCase
class TestConsumeLocalizationFile < CommandTest
def new_runner(language, file)
options = {}
options[:output_path] = File.join(@output_dir, file) if file
@ -51,7 +51,7 @@ class TestConsumeLocalizationFile < CommandTestCase
new_runner(nil, "#{random_language}.xml").consume_localization_file
end
class TestEncodings < CommandTestCase
class TestEncodings < CommandTest
class DummyFormatter < Twine::Formatters::Abstract
attr_reader :content

View file

@ -1,6 +1,6 @@
require 'twine_test_case'
require 'twine_test'
class FormatterTest < TwineTestCase
class FormatterTest < TwineTest
def setup(formatter_class)
super()

View file

@ -1,6 +1,6 @@
require 'command_test_case'
require 'command_test'
class TestGenerateAllLocalizationFiles < CommandTestCase
class TestGenerateAllLocalizationFiles < CommandTest
def new_runner(create_folders, twine_file = nil)
options = {}
options[:output_path] = @output_dir
@ -68,7 +68,7 @@ class TestGenerateAllLocalizationFiles < CommandTestCase
end
end
class TestValidate < CommandTestCase
class TestValidate < CommandTest
def new_runner(validate)
Dir.mkdir File.join @output_dir, 'values-en'

View file

@ -1,6 +1,6 @@
require 'command_test_case'
require 'command_test'
class TestGenerateLocDrop < CommandTestCase
class TestGenerateLocDrop < CommandTest
def new_runner(twine_file = nil)
options = {}
options[:output_path] = @output_path
@ -48,7 +48,7 @@ class TestGenerateLocDrop < CommandTestCase
assert_match "Skipping file", Twine::stderr.string
end
class TestValidate < CommandTestCase
class TestValidate < CommandTest
def new_runner(validate)
options = {}
options[:output_path] = @output_path

View file

@ -1,6 +1,6 @@
require 'command_test_case'
require 'command_test'
class TestGenerateLocalizationFile < CommandTestCase
class TestGenerateLocalizationFile < CommandTest
def new_runner(language, file)
options = {}
options[:output_path] = File.join(@output_dir, file) if file
@ -58,7 +58,7 @@ class TestGenerateLocalizationFile < CommandTestCase
end
end
class TestValidate < CommandTestCase
class TestValidate < CommandTest
def new_runner(validate)
options = {}
options[:output_path] = @output_path

View file

@ -1,6 +1,6 @@
require 'twine_test_case'
require 'twine_test'
class TestOutputProcessor < TwineTestCase
class TestOutputProcessor < TwineTest
def setup
super
@ -56,7 +56,7 @@ class TestOutputProcessor < TwineTestCase
assert_equal %w(key1 key2 key3), result.definitions_by_key.keys.sort
end
class TranslationFallback < TwineTestCase
class TranslationFallback < TwineTest
def setup
super

View file

@ -1,6 +1,6 @@
require 'twine_test_case'
require 'twine_test'
class PlaceholderTestCase < TwineTestCase
class PlaceholderTest < TwineTest
def assert_starts_with(prefix, value)
msg = message(nil) { "Expected #{mu_pp(value)} to start with #{mu_pp(prefix)}" }
assert value.start_with?(prefix), msg
@ -17,10 +17,8 @@ class PlaceholderTestCase < TwineTestCase
placeholder += %w(h hh l ll L z j t).sample if lucky.call
placeholder += type || 'diufFeEgGxXocpaA'.chars.to_a.sample # this does not contain s or @ because strings are a special case
end
end
class PlaceholderTest < TwineTestCase
class ToAndroid < PlaceholderTestCase
class ToAndroid < PlaceholderTest
def to_android(value)
Twine::Placeholders.convert_placeholders_from_twine_to_android(value)
end
@ -74,7 +72,7 @@ class PlaceholderTest < TwineTestCase
end
end
class FromAndroid < PlaceholderTestCase
class FromAndroid < PlaceholderTest
def from_android(value)
Twine::Placeholders.convert_placeholders_from_android_to_twine(value)
end

View file

@ -1,6 +1,6 @@
require 'twine_test_case'
require 'twine_test'
class TestTwineDefinition < TwineTestCase
class TestTwineDefinition < TwineTest
def setup
super

View file

@ -1,7 +1,7 @@
require 'twine_test_case'
require 'twine_test'
class TestTwineFile < TwineTestCase
class Reading < TwineTestCase
class TestTwineFile < TwineTest
class Reading < TwineTest
def setup
super
@ -34,7 +34,7 @@ class TestTwineFile < TwineTestCase
end
end
class Writing < TwineTestCase
class Writing < TwineTest
def test_accent_wrapping
@twine_file = build_twine_file 'en' do

View file

@ -1,8 +1,8 @@
# encoding: utf-8
require 'command_test_case'
require 'command_test'
class TestValidateTwineFile < CommandTestCase
class TestValidateTwineFile < CommandTest
def setup
super
@options = { twine_file: 'input.txt' }

View file

@ -6,7 +6,7 @@ require 'stringio'
require 'twine'
require 'twine_file_dsl'
class TwineTestCase < Minitest::Test
class TwineTest < Minitest::Test
include TwineFileDSL
KNOWN_LANGUAGES = %w(en fr de es)