implement assignment normalisation

especially when the value is a send that needs normalising
fixes several broken tests
This commit is contained in:
Torsten Ruger
2018-04-27 21:56:41 +03:00
parent 1685ba5a44
commit d84d208192
6 changed files with 134 additions and 12 deletions

View File

@ -3,7 +3,26 @@ require_relative 'helper'
module Methods
class TestFibo < MethodsTest
def est_ruby_adds
def test_count_down
run_space <<HERE
def down( n )
if( n < 2 )
return n
else
a = down(n - 1)
return a
end
end
def main(arg)
return down(8)
end
HERE
assert_equal Parfait::Integer , get_return.class
assert_equal 1 , get_return.value
end
def est_fibo
run_space <<HERE
def fibo_r( n )
if( n < 2 )

View File

@ -3,17 +3,31 @@ require_relative 'helper'
module Methods
class TestCallSimple < MethodsTest
def test_call
def test_simple
run_space <<HERE
def called( n )
def same( n )
return n
end
def main(arg)
return called(8)
return same(8)
end
HERE
assert_equal Parfait::Integer , get_return.class
assert_equal 8 , get_return.value
end
def test_call_with_call
run_space <<HERE
def same( n )
return n
end
def main(arg)
a = same(8 - 1)
return a
end
HERE
assert_equal Parfait::Integer , get_return.class
assert_equal 7 , get_return.value
end
end
end