pass return integer back out through exit

for testing of binaries later (and off course general correctness)
Some tests were using the fact that the interpreter was used, changed those to return ints rather than strings
This commit is contained in:
Torsten Ruger
2018-06-19 18:55:47 +03:00
parent db459fcd3d
commit 5f7683efcf
33 changed files with 174 additions and 152 deletions

View File

@ -13,8 +13,7 @@ module Mains
end
return a
HERE
assert_equal Parfait::Integer , get_return.class
assert_equal 10 , get_return.value
assert_equal 10 , get_return
end
def test_ruby_subs
run_main <<HERE
@ -24,8 +23,7 @@ HERE
end
return b
HERE
assert_equal Parfait::Integer , get_return.class
assert_equal 0 , get_return.value
assert_equal 0 , get_return
end
def test_ruby_adds_fibo
run_main <<HERE
@ -41,8 +39,7 @@ HERE
end
return result
HERE
assert_equal Parfait::Integer , get_return.class
assert_equal 8 , get_return.value
assert_equal 8 , get_return
end
end
end

View File

@ -1,13 +1,12 @@
require_relative 'helper'
module Mains
class TestPuts #< MainsTest
class TestPuts < MainsTest
def test_say_hi
hi = "Hello there"
run_main "'#{hi}'.putstring"
assert_equal Parfait::Integer , get_return.class
assert_equal hi.length , get_return.value
run_main_return "'#{hi}'.putstring"
assert_equal hi.length , get_return
assert_equal hi , @interpreter.stdout
end
end