From 89f5badc169b4482b750a3954eb087092a7143e5 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Wed, 11 Jan 2017 19:18:04 +0200 Subject: [PATCH] putting melon tests into module and splitting to one per file --- test/melon/fragments/helper.rb | 16 ++++--- test/melon/fragments/test_adds.rb | 61 ++++++++----------------- test/melon/fragments/test_calls.rb | 51 ++++++--------------- test/melon/fragments/test_hello.rb | 30 ++++-------- test/melon/fragments/test_itos.rb | 30 ++++-------- test/melon/fragments/test_loop.rb | 24 +++++----- test/melon/fragments/test_many_adds.rb | 34 ++++++++++++++ test/melon/fragments/test_many_calls.rb | 30 ++++++++++++ test/melon/fragments/test_many_hello.rb | 21 +++++++++ test/melon/fragments/test_namy_itos.rb | 22 +++++++++ 10 files changed, 181 insertions(+), 138 deletions(-) create mode 100644 test/melon/fragments/test_many_adds.rb create mode 100644 test/melon/fragments/test_many_calls.rb create mode 100644 test/melon/fragments/test_many_hello.rb create mode 100644 test/melon/fragments/test_namy_itos.rb diff --git a/test/melon/fragments/helper.rb b/test/melon/fragments/helper.rb index 3d8461b4..e5abb691 100644 --- a/test/melon/fragments/helper.rb +++ b/test/melon/fragments/helper.rb @@ -2,14 +2,16 @@ require_relative '../helper' require "register/interpreter" require "parser/ruby22" -module MelonTests +module Melon + module MelonTests - def setup - @parser = Parser::Ruby22 - end + def setup + @parser = Parser::Ruby22 + end - def check - assert true - #puts @parser.parse @string_input + def check + assert true + #puts @parser.parse @string_input + end end end diff --git a/test/melon/fragments/test_adds.rb b/test/melon/fragments/test_adds.rb index bed6f394..9c8ab13e 100644 --- a/test/melon/fragments/test_adds.rb +++ b/test/melon/fragments/test_adds.rb @@ -1,51 +1,26 @@ require_relative 'helper' -class TestRubyAdds < MiniTest::Test - include MelonTests +module Melon + class TestRubyAdds < MiniTest::Test + include MelonTests - def test_ruby_adds - @string_input = < 0) do - fibo(40) - counter -= 1 - end -HERE - @length = 37 - @stdout = "Hello Raisa, I am salama" - check end end diff --git a/test/melon/fragments/test_calls.rb b/test/melon/fragments/test_calls.rb index 13d84493..7fde7d46 100644 --- a/test/melon/fragments/test_calls.rb +++ b/test/melon/fragments/test_calls.rb @@ -1,45 +1,24 @@ require_relative 'helper' -class TestRubyCalls < MiniTest::Test - include MelonTests +module Melon + class TestRubyCalls < MiniTest::Test + include MelonTests - def test_ruby_calls - @string_input = < 0) do - fibo_r(20) - counter -= 1 - end -HERE - @length = 37 - @stdout = "" - check end end diff --git a/test/melon/fragments/test_hello.rb b/test/melon/fragments/test_hello.rb index 52d8e279..299021cd 100644 --- a/test/melon/fragments/test_hello.rb +++ b/test/melon/fragments/test_hello.rb @@ -1,27 +1,17 @@ require_relative 'helper' -class TestRubyHello < MiniTest::Test - include MelonTests +module Melon + class TestRubyHello < MiniTest::Test + include MelonTests - def test_ruby_hello - @string_input = < 0) do - puts "Hello there" - STDOUT.flush - counter = counter - 1 - end + def test_ruby_hello + @string_input = < 0) do - str = counter.to_s - counter = counter - 1 - end - str -HERE - @length = 37 - @stdout = "Hello Raisa, I am salama" - check end end diff --git a/test/melon/fragments/test_loop.rb b/test/melon/fragments/test_loop.rb index 4e736cab..aeaaf228 100644 --- a/test/melon/fragments/test_loop.rb +++ b/test/melon/fragments/test_loop.rb @@ -1,17 +1,19 @@ require_relative 'helper' -class TestRubyLoop < MiniTest::Test - include MelonTests +module Melon + class TestRubyLoop < MiniTest::Test + include MelonTests - def test_ruby_loop - @string_input = < 0) do - counter -= 1 -end -HERE - @stdout = "Hello there" - check + def pest_ruby_loop + @string_input = < 0) do + counter -= 1 end +HERE + @stdout = "Hello there" + check + end + end end diff --git a/test/melon/fragments/test_many_adds.rb b/test/melon/fragments/test_many_adds.rb new file mode 100644 index 00000000..48809438 --- /dev/null +++ b/test/melon/fragments/test_many_adds.rb @@ -0,0 +1,34 @@ +require_relative 'helper' + +module Melon + class TestManyAdds < MiniTest::Test + include MelonTests + + def pest_ruby_adds_looping + @string_input = < 0) do + fibo(40) + counter -= 1 + end +HERE + @length = 37 + @stdout = "Hello there" + check + end + end +end diff --git a/test/melon/fragments/test_many_calls.rb b/test/melon/fragments/test_many_calls.rb new file mode 100644 index 00000000..b249bd0f --- /dev/null +++ b/test/melon/fragments/test_many_calls.rb @@ -0,0 +1,30 @@ +require_relative 'helper' + +module Melon + class TestManyCalls < MiniTest::Test + include MelonTests + + def pest_ruby_calls_looping + @string_input = < 0) do + fibo_r(20) + counter -= 1 + end +HERE + @length = 37 + @stdout = "" + check + end + end +end diff --git a/test/melon/fragments/test_many_hello.rb b/test/melon/fragments/test_many_hello.rb new file mode 100644 index 00000000..2575c16b --- /dev/null +++ b/test/melon/fragments/test_many_hello.rb @@ -0,0 +1,21 @@ +require_relative 'helper' + +module Melon + class TestManyHello < MiniTest::Test + include MelonTests + + def pest_ruby_hello_looping + @string_input = < 0) do + puts "Hello there" + STDOUT.flush + counter = counter - 1 + end +HERE + @length = 37 + @stdout = "Hello there" + check + end + end +end diff --git a/test/melon/fragments/test_namy_itos.rb b/test/melon/fragments/test_namy_itos.rb new file mode 100644 index 00000000..71d609a4 --- /dev/null +++ b/test/melon/fragments/test_namy_itos.rb @@ -0,0 +1,22 @@ +require_relative 'helper' + +module Melon + class TestManyItos < MiniTest::Test + include MelonTests + + def pest_ruby_itos_looping + @string_input = < 0) do + str = counter.to_s + counter = counter - 1 + end + str +HERE + @length = 37 + @stdout = "Hello Raisa, I am salama" + check + end + end +end