test local variables

need the assignenment first in the same scope so parser knows its a lvar
This commit is contained in:
Torsten Ruger 2017-04-05 14:03:36 +03:00
parent 4de57dbe4d
commit bc0b71d0cd

View File

@ -5,10 +5,17 @@ module Vool
# "free standing" local can not be tested as it will result in send # "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 # in other words ther is no way of knowing if a name is variable or method
# def test_send_to_local # one needs an assignemnt first, to "tell" the parser it's a local
# lst = Compiler.compile( "foo.bar") def test_local_basic
# assert_equal SendStatement , lst.class lst = Compiler.compile( "foo = 1 ; foo")
# end assert_equal ScopeStatement , lst.class
assert_equal LocalVariable , lst.statements[1].class
end
def test_local_nane
lst = Compiler.compile( "foo = 1 ; foo")
assert_equal LocalVariable , lst.statements[1].class
end
def test_instance_basic def test_instance_basic
lst = Compiler.compile( "@var" ) lst = Compiler.compile( "@var" )