add the idea of a frame
This commit is contained in:
@ -12,35 +12,35 @@ class TestBasic < MiniTest::Test
|
||||
|
||||
def test_name
|
||||
@string_input = 'foo '
|
||||
@output = Ast::NameExpression.new('foo')
|
||||
@parser = @parser.name
|
||||
@output = [nil]
|
||||
check
|
||||
end
|
||||
|
||||
def test_name_underscode_start
|
||||
@string_input = '_bar '
|
||||
@output = Ast::NameExpression.new('_bar')
|
||||
@parser = @parser.name
|
||||
check
|
||||
end
|
||||
|
||||
def test_name_underscode_middle
|
||||
@string_input = 'foo_bar '
|
||||
@parse_output = {:name => 'foo_bar'}
|
||||
@output = Ast::NameExpression.new('foo_bar')
|
||||
@parser = @parser.name
|
||||
check
|
||||
end
|
||||
|
||||
def test_instance_variable
|
||||
@string_input = '@foo_bar '
|
||||
@parse_output = {:instance_variable=>{:name=>"foo_bar"}}
|
||||
@output = Ast::VariableExpression.new(:foo_bar)
|
||||
@parser = @parser.instance_variable
|
||||
check
|
||||
end
|
||||
|
||||
def test_module_name
|
||||
@string_input = 'FooBar '
|
||||
@parse_output = {:module_name=>"FooBar"}
|
||||
@output = Ast::ModuleName.new("FooBar")
|
||||
@parser = @parser.module_name
|
||||
check
|
||||
end
|
||||
|
||||
def test_comment
|
||||
@ -48,14 +48,14 @@ class TestBasic < MiniTest::Test
|
||||
@string_input = out.dup #NEEDS the return, which is what delimits the comment
|
||||
@parse_output = out
|
||||
@output = @parse_output #dont transform
|
||||
@parser = @parser.comment
|
||||
check
|
||||
end
|
||||
|
||||
def test_string
|
||||
@string_input = "\"hello\""
|
||||
@parse_output = {:string=>[{:char=>"h"}, {:char=>"e"}, {:char=>"l"}, {:char=>"l"}, {:char=>"o"}]}
|
||||
@output = Ast::StringExpression.new('hello')
|
||||
@parser = @parser.string
|
||||
check
|
||||
end
|
||||
|
||||
def test_string_escapes
|
||||
@ -64,7 +64,7 @@ class TestBasic < MiniTest::Test
|
||||
@parse_output = {:string=>[{:char=>"h"}, {:char=>"e"}, {:char=>"l"}, {:char=>"l"}, {:char=>"o"},
|
||||
{:char=>" "}, {:char=>" "}, {:esc=>"n"}, {:char=>"y"}, {:char=>"o"}, {:char=>"u"}]}
|
||||
@output = Ast::StringExpression.new(out)
|
||||
@parser = @parser.string
|
||||
check
|
||||
end
|
||||
|
||||
end
|
Reference in New Issue
Block a user