fix argument hoisting
arguments in vool must be simple variables finally did the hoisting to do that
This commit is contained in:
13
test/vool/normalization/helper.rb
Normal file
13
test/vool/normalization/helper.rb
Normal file
@ -0,0 +1,13 @@
|
||||
require_relative "../helper"
|
||||
|
||||
module Vool
|
||||
module Norm
|
||||
|
||||
class NormTest < MiniTest::Test
|
||||
|
||||
def normalize(input)
|
||||
RubyCompiler.compile(input).normalize
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
35
test/vool/normalization/test_send_statement.rb
Normal file
35
test/vool/normalization/test_send_statement.rb
Normal file
@ -0,0 +1,35 @@
|
||||
require_relative "helper"
|
||||
|
||||
module Vool
|
||||
module Norm
|
||||
|
||||
class TestSendSimple < NormTest
|
||||
def test_simple
|
||||
lst = normalize("foo")
|
||||
assert_equal SendStatement , lst.class
|
||||
end
|
||||
def test_constant_args
|
||||
lst = normalize("foo(1,2)")
|
||||
assert_equal SendStatement , lst.class
|
||||
end
|
||||
end
|
||||
class TestSendSend < NormTest
|
||||
def setup
|
||||
super
|
||||
@stm = normalize("foo(1 - 2)")
|
||||
end
|
||||
def test_many
|
||||
assert_equal Statements , @stm.class
|
||||
end
|
||||
def test_assignment
|
||||
assert_equal LocalAssignment , @stm.first.class
|
||||
end
|
||||
def test_name
|
||||
assert @stm.first.name.to_s.start_with?("tmp_") , @stm.first.name
|
||||
end
|
||||
def test_assigned
|
||||
assert_equal SendStatement , @stm.first.value.class
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user