add scope and kwbegin
scope is just a list of statements
This commit is contained in:
@ -5,7 +5,7 @@ module Vool
|
||||
|
||||
def test_self
|
||||
lst = Compiler.compile( "self")
|
||||
assert_equal SelfStatement , lst.class
|
||||
assert_equal SelfStatement , lst.class
|
||||
end
|
||||
def test_nil
|
||||
lst = Compiler.compile( "nil")
|
||||
@ -36,5 +36,14 @@ module Vool
|
||||
Compiler.compile( '"dstr#{self}"')
|
||||
end
|
||||
end
|
||||
|
||||
def test_scope
|
||||
lst = Compiler.compile( "begin ; 1 ; end")
|
||||
assert_equal ScopeStatement , lst.class , lst.inspect
|
||||
end
|
||||
def test_scope_contents
|
||||
lst = Compiler.compile( "begin ; 1 ; end")
|
||||
assert_equal 1 , lst.statements.first.value
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -36,6 +36,5 @@ module Vool
|
||||
lst = Compiler.compile( "bar(1)")
|
||||
assert_equal 1 , lst.arguments.first.value
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
14
test/vool/test_variables.rb
Normal file
14
test/vool/test_variables.rb
Normal file
@ -0,0 +1,14 @@
|
||||
require_relative "../helper"
|
||||
|
||||
module Vool
|
||||
class TestVariables < MiniTest::Test
|
||||
|
||||
# "free standing" local can not be tested as it will result in send
|
||||
# in other words ther is no way of knowing if a name is variable or method
|
||||
def ptest_send_to_local
|
||||
lst = Compiler.compile( "foo = 1 ; foo.bar")
|
||||
assert_equal LocalVariable , lst.receiver
|
||||
end
|
||||
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user