add module names and instance variables as parse rules

This commit is contained in:
Torsten Ruger
2014-05-30 12:06:42 +03:00
parent 3e93517986
commit f03d445f3d
4 changed files with 42 additions and 1 deletions

View File

@ -18,6 +18,34 @@ class TestBasic < MiniTest::Test
@parser = @parser.name
end
def test_name_underscode_start
@string_input = '_bar '
@parse_output = {:name => '_bar'}
@transform_output = Ast::NameExpression.new('_bar')
@parser = @parser.name
end
def test_name_underscode_middle
@string_input = 'foo_bar '
@parse_output = {:name => 'foo_bar'}
@transform_output = Ast::NameExpression.new('foo_bar')
@parser = @parser.name
end
def test_instance_variable
@string_input = '@foo_bar '
@parse_output = {:instance_variable=>{:name=>"foo_bar"}}
@transform_output = Ast::VariableExpression.new('foo_bar')
@parser = @parser.instance_variable
end
def test_module_name
@string_input = 'FooBar '
@parse_output = {:module_name=>"FooBar"}
@transform_output = Ast::ModuleName.new("FooBar")
@parser = @parser.module_name
end
def test_comment
out = "# i am a comment \n"
@string_input = out.dup #NEEDS the return, which is what delimits the comment