{
TEST(Should parse basic module syntax)
{
- parse_module("Empty",
- "module Empty; end Empty;");
- parse_module("ModA",
- "module ModA; import ModB; end ModA;");
+ parse_module("Empty", "module Empty; end Empty;");
+ parse_module("ModA", "module ModA; import ModB; end ModA;");
}
TEST(Should parse imports)
{
- parse_rule(import_list, 0,
- "import A;");
- parse_rule(import_list, 0,
- "import A = ModA;");
- parse_rule(import_list, 0,
- "import A, B;");
- parse_rule(import_list, 0,
- "import A, B = ModB, C;");
+ parse_rule(import_list, 0, "import A;");
+ parse_rule(import_list, 0, "import A = ModA;");
+ parse_rule(import_list, 0, "import A, B;");
+ parse_rule(import_list, 0, "import A, B = ModB, C;");
}
TEST(Should parse constant declarations and expressions)
{
- parse_rule(const_decl, 0,
- "FOO = 123");
- parse_rule(const_decl, 0,
- "FOO = 123.123");
- parse_rule(const_decl, 0,
- "FOO = \"\"");
- parse_rule(const_decl, 0,
- "FOO = true");
- parse_rule(const_decl, 0,
- "FOO = false");
-// parse_rule(const_decl, 0,
-// "FOO = nil");
- parse_rule(const_decl, 0,
- "FOO = not true");
- parse_rule(const_decl, 0,
- "FOO = (not false)");
- parse_rule(const_decl, 0,
- "FOO = +1");
- parse_rule(const_decl, 0,
- "FOO = -1");
- parse_rule(const_decl, 0,
- "FOO = +1.0");
- parse_rule(const_decl, 0,
- "FOO = -1.0");
- parse_rule(const_decl, 0,
- "FOO = 1 + 2");
- parse_rule(const_decl, 0,
- "FOO = 1.0 + 2.0");
- parse_rule(const_decl, 0,
- "FOO = 1 - 2");
- parse_rule(const_decl, 0,
- "FOO = 1.0 - 2.0");
- parse_rule(const_decl, 0,
- "FOO = 3 * 2");
- parse_rule(const_decl, 0,
- "FOO = 3.0 * 2.0");
- parse_rule(const_decl, 0,
- "FOO = 4 / 2");
- parse_rule(const_decl, 0,
- "FOO = 3.0 / 4.0");
- parse_rule(const_decl, 0,
- "FOO = 5 % 3");
- parse_rule(const_decl, 0,
- "FOO = 5 == 3");
- parse_rule(const_decl, 0,
- "FOO = 5 != 3");
- parse_rule(const_decl, 0,
- "FOO = 5 < 3");
- parse_rule(const_decl, 0,
- "FOO = 5 <= 3");
- parse_rule(const_decl, 0,
- "FOO = 5 > 3");
- parse_rule(const_decl, 0,
- "FOO = 5 >= 3");
- parse_rule(const_decl, 0,
- "FOO = 5, BAR = FOO - 3");
+ parse_rule(const_decl, 0, "FOO = 123");
+ parse_rule(const_decl, 0, "FOO = 123.123");
+ parse_rule(const_decl, 0, "FOO = \"\"");
+ parse_rule(const_decl, 0, "FOO = true");
+ parse_rule(const_decl, 0, "FOO = false");
+// parse_rule(const_decl, 0, "FOO = nil");
+ parse_rule(const_decl, 0, "FOO = not true");
+ parse_rule(const_decl, 0, "FOO = (not false)");
+ parse_rule(const_decl, 0, "FOO = +1");
+ parse_rule(const_decl, 0, "FOO = -1");
+ parse_rule(const_decl, 0, "FOO = +1.0");
+ parse_rule(const_decl, 0, "FOO = -1.0");
+ parse_rule(const_decl, 0, "FOO = 1 + 2");
+ parse_rule(const_decl, 0, "FOO = 1.0 + 2.0");
+ parse_rule(const_decl, 0, "FOO = 1 - 2");
+ parse_rule(const_decl, 0, "FOO = 1.0 - 2.0");
+ parse_rule(const_decl, 0, "FOO = 3 * 2");
+ parse_rule(const_decl, 0, "FOO = 3.0 * 2.0");
+ parse_rule(const_decl, 0, "FOO = 4 / 2");
+ parse_rule(const_decl, 0, "FOO = 3.0 / 4.0");
+ parse_rule(const_decl, 0, "FOO = 5 % 3");
+ parse_rule(const_decl, 0, "FOO = 5 == 3");
+ parse_rule(const_decl, 0, "FOO = 5 != 3");
+ parse_rule(const_decl, 0, "FOO = 5 < 3");
+ parse_rule(const_decl, 0, "FOO = 5 <= 3");
+ parse_rule(const_decl, 0, "FOO = 5 > 3");
+ parse_rule(const_decl, 0, "FOO = 5 >= 3");
+ parse_rule(const_decl, 0, "FOO = 5, BAR = FOO - 3");
}
}
#endif