import unittest import util from hutn_compiler.compiler import do_compile def parse_file(filename): return not do_compile(util.get_code_path(filename), "grammars/actionlanguage.g", None) class TestValids(unittest.TestCase): def test_empty(self): self.assertTrue(parse_file("full_empty.al")) def test_assign_to_constant(self): self.assertTrue(parse_file("assign_to_constant.al")) def test_assign_to_func_result(self): self.assertTrue(parse_file("assign_to_func_result.al")) def test_assign_to_statement(self): self.assertTrue(parse_file("assign_to_statement.al")) def test_return_in_assign(self): self.assertTrue(parse_file("return_in_assign.al")) def test_while_no_condition(self): self.assertTrue(parse_file("while_no_condition.al")) def test_if_no_condition(self): self.assertTrue(parse_file("if_no_condition.al")) def test_if_only_else(self): self.assertTrue(parse_file("if_only_else.al")) def test_if_empty_body(self): self.assertTrue(parse_file("if_empty_body.al")) def test_if_empty_else(self): self.assertTrue(parse_file("if_empty_else.al")) def test_while_empty_body(self): self.assertTrue(parse_file("while_empty_body.al")) def test_funcdef_empty_body(self): self.assertTrue(parse_file("funcdef_empty_body.al")) def test_include_late(self): self.assertTrue(parse_file("include_late.al"))