remove the keywords citrus file (less clutter)

This commit is contained in:
Torsten Ruger
2015-09-14 17:00:36 +03:00
parent acf4046225
commit 114817602e
5 changed files with 51 additions and 57 deletions

View File

@ -3,11 +3,11 @@ require_relative "../setup"
class TestBasic < MiniTest::Test
#test basics and keyword expressions. Keywords includes BasicTypes
def setup
@parser = Keywords
@parser = BasicTypes
end
def check
parse = @parser.parse(@input)
def check rule = :root
parse = @parser.parse(@input , :root => rule)
assert_equal @input , parse
assert_equal @output , parse.value
end
@ -15,62 +15,62 @@ class TestBasic < MiniTest::Test
def test_true
@input = 'true '
@output = Ast::TrueExpression.new()
check
check :keyword_true
end
def test_false
@input = 'false '
@output = Ast::FalseExpression.new()
check
check :keyword_false
end
def test_nil
@input = 'nil '
@output = Ast::NilExpression.new()
check
check :keyword_nil
end
def test_integer
@input = '42 '
@output = Ast::IntegerExpression.new(42)
check
check :integer_expression
end
def test_name
@input = 'foo '
@output = Ast::NameExpression.new('foo')
check
check :name_expression
end
def test_name_underscode_start
@input = '_bar '
@output = Ast::NameExpression.new('_bar')
check
check :name_expression
end
def test_name_underscode_middle
@input = 'foo_bar '
@output = Ast::NameExpression.new('foo_bar')
check
check :name_expression
end
def test_module_name
@input = 'FooBar '
@output = Ast::ModuleName.new("FooBar")
check
check :module_name_expression
end
def test_string
@input = '"hello"'
@output = Ast::StringExpression.new('hello')
check
check :string_expression
end
def test_string_escapes
out = 'hello \nyou'
@input = '"' + out + '"'
@output = Ast::StringExpression.new(out)
check
check :string_expression
end
end