rubyx/test/vool/compilers/test_local_collect.rb
Torsten Ruger b0e3978b15 starts on local variable collection
500 tests (in under 2 seconds), yippie
2017-04-08 12:28:31 +03:00

28 lines
558 B
Ruby

require_relative "helper"
module Vool
module Compilers
class TestLocalCollect < MiniTest::Test
def compile(input)
lst = VoolCompiler.compile( input )
vars = []
lst.collect([]).each do |node|
node.add_local(vars)
end
vars
end
def test_assign_collect
vars = compile( "var = 5" )
assert_equal :var , vars.first
end
def test_return_collect
vars = compile( "var = 5 ; return var" )
assert_equal :var , vars.first
end
end
end
end