diff --git a/lib/parser/crystal.rb b/lib/parser/crystal.rb index ee14cb3..a625723 100644 --- a/lib/parser/crystal.rb +++ b/lib/parser/crystal.rb @@ -31,7 +31,7 @@ module Parser include Operators include ModuleDef - rule(:root_body) {(module_definition | class_definition | function_definition | expression | call_site )} + rule(:root_body) {(module_definition | class_definition | function_definition | expression | call_site | basic_type )} rule(:root) { root_body.repeat.as(:expression_list) } end end diff --git a/test/test_root.rb b/test/roots/test_root.rb similarity index 99% rename from test/test_root.rb rename to test/roots/test_root.rb index f06a70f..38b8d6e 100644 --- a/test/test_root.rb +++ b/test/roots/test_root.rb @@ -1,4 +1,4 @@ -require_relative "parser_helper" +require_relative "../parser_helper" class TestRoot < MiniTest::Test # include the magic (setup and parse -> test method translation), see there diff --git a/test/test_all.rb b/test/test_all.rb index 568dcf2..ec3277d 100644 --- a/test/test_all.rb +++ b/test/test_all.rb @@ -1,14 +1,2 @@ - -require_relative "test_arguments" -require_relative "test_basic" -require_relative "test_call_site" -require_relative "test_class" -require_relative "test_compound" -require_relative "test_conditional" -require_relative "test_expressions" -require_relative "test_function_definition" -require_relative "test_module" -require_relative "test_operators" -require_relative "test_return" -require_relative "test_root" -require_relative "test_while" +require_relative "unit/test_all" +require_relative "roots/test_root" diff --git a/test/unit/test_all.rb b/test/unit/test_all.rb new file mode 100644 index 0000000..cf4a9de --- /dev/null +++ b/test/unit/test_all.rb @@ -0,0 +1,13 @@ + +require_relative "test_arguments" +require_relative "test_basic" +require_relative "test_call_site" +require_relative "test_class" +require_relative "test_compound" +require_relative "test_conditional" +require_relative "test_expressions" +require_relative "test_function_definition" +require_relative "test_module" +require_relative "test_operators" +require_relative "test_return" +require_relative "test_while" diff --git a/test/test_arguments.rb b/test/unit/test_arguments.rb similarity index 97% rename from test/test_arguments.rb rename to test/unit/test_arguments.rb index 0884ed7..af572d0 100644 --- a/test/test_arguments.rb +++ b/test/unit/test_arguments.rb @@ -1,4 +1,4 @@ -require_relative "parser_helper" +require_relative "../parser_helper" class TestArguments < MiniTest::Test # include the magic (setup and parse -> test method translation), see there diff --git a/test/test_basic.rb b/test/unit/test_basic.rb similarity index 98% rename from test/test_basic.rb rename to test/unit/test_basic.rb index d7aa663..ba0ebea 100644 --- a/test/test_basic.rb +++ b/test/unit/test_basic.rb @@ -1,4 +1,4 @@ -require_relative "parser_helper" +require_relative "../parser_helper" class TestBasic < MiniTest::Test # include the magic (setup and parse -> test method translation), see there diff --git a/test/test_call_site.rb b/test/unit/test_call_site.rb similarity index 99% rename from test/test_call_site.rb rename to test/unit/test_call_site.rb index ed2f3a6..9418ebb 100644 --- a/test/test_call_site.rb +++ b/test/unit/test_call_site.rb @@ -1,4 +1,4 @@ -require_relative "parser_helper" +require_relative "../parser_helper" class TestCallSite < MiniTest::Test # include the magic (setup and parse -> test method translation), see there diff --git a/test/test_class.rb b/test/unit/test_class.rb similarity index 99% rename from test/test_class.rb rename to test/unit/test_class.rb index a98cbbd..7c1234b 100644 --- a/test/test_class.rb +++ b/test/unit/test_class.rb @@ -1,4 +1,4 @@ -require_relative "parser_helper" +require_relative "../parser_helper" class TestClassDef < MiniTest::Test # include the magic (setup and parse -> test method translation), see there diff --git a/test/test_compound.rb b/test/unit/test_compound.rb similarity index 98% rename from test/test_compound.rb rename to test/unit/test_compound.rb index fa048ca..4c00e77 100644 --- a/test/test_compound.rb +++ b/test/unit/test_compound.rb @@ -1,4 +1,4 @@ -require_relative "parser_helper" +require_relative "../parser_helper" class TestCompound < MiniTest::Test # include the magic (setup and parse -> test method translation), see there diff --git a/test/test_conditional.rb b/test/unit/test_conditional.rb similarity index 97% rename from test/test_conditional.rb rename to test/unit/test_conditional.rb index bc083ac..c5798fc 100644 --- a/test/test_conditional.rb +++ b/test/unit/test_conditional.rb @@ -1,4 +1,4 @@ -require_relative "parser_helper" +require_relative "../parser_helper" class TestConditional < MiniTest::Test # include the magic (setup and parse -> test method translation), see there diff --git a/test/test_expressions.rb b/test/unit/test_expressions.rb similarity index 97% rename from test/test_expressions.rb rename to test/unit/test_expressions.rb index cd79618..05c74c2 100644 --- a/test/test_expressions.rb +++ b/test/unit/test_expressions.rb @@ -1,4 +1,4 @@ -require_relative "parser_helper" +require_relative "../parser_helper" class TestExpressions < MiniTest::Test # include the magic (setup and parse -> test method translation), see there diff --git a/test/test_fails.rb b/test/unit/test_fails.rb similarity index 94% rename from test/test_fails.rb rename to test/unit/test_fails.rb index 6adbc01..bcf26a4 100644 --- a/test/test_fails.rb +++ b/test/unit/test_fails.rb @@ -1,4 +1,4 @@ -require_relative "parser_helper" +require_relative "../parser_helper" # some cases that fail, and fail badly. diff --git a/test/test_function_definition.rb b/test/unit/test_function_definition.rb similarity index 99% rename from test/test_function_definition.rb rename to test/unit/test_function_definition.rb index 122b654..0824f46 100644 --- a/test/test_function_definition.rb +++ b/test/unit/test_function_definition.rb @@ -1,4 +1,4 @@ -require_relative "parser_helper" +require_relative "../parser_helper" class TestFunctionDefinition < MiniTest::Test # include the magic (setup and parse -> test method translation), see there diff --git a/test/test_module.rb b/test/unit/test_module.rb similarity index 99% rename from test/test_module.rb rename to test/unit/test_module.rb index 07e6db3..6f9cdc4 100644 --- a/test/test_module.rb +++ b/test/unit/test_module.rb @@ -1,4 +1,4 @@ -require_relative "parser_helper" +require_relative "../parser_helper" class TestModuleDef < MiniTest::Test # include the magic (setup and parse -> test method translation), see there diff --git a/test/test_operators.rb b/test/unit/test_operators.rb similarity index 99% rename from test/test_operators.rb rename to test/unit/test_operators.rb index 00621de..78ae76a 100644 --- a/test/test_operators.rb +++ b/test/unit/test_operators.rb @@ -1,4 +1,4 @@ -require_relative "parser_helper" +require_relative "../parser_helper" class TestExpressions < MiniTest::Test # include the magic (setup and parse -> test method translation), see there diff --git a/test/test_return.rb b/test/unit/test_return.rb similarity index 96% rename from test/test_return.rb rename to test/unit/test_return.rb index 6bdef96..cbf8568 100644 --- a/test/test_return.rb +++ b/test/unit/test_return.rb @@ -1,4 +1,4 @@ -require_relative "parser_helper" +require_relative "../parser_helper" class TestReturn < MiniTest::Test # include the magic (setup and parse -> test method translation), see there diff --git a/test/test_while.rb b/test/unit/test_while.rb similarity index 98% rename from test/test_while.rb rename to test/unit/test_while.rb index e3b8bac..2d5e192 100644 --- a/test/test_while.rb +++ b/test/unit/test_while.rb @@ -1,4 +1,4 @@ -require_relative "parser_helper" +require_relative "../parser_helper" class TestWhile < MiniTest::Test # include the magic (setup and parse -> test method translation), see there