1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- import unittest
- import util
- from hutn_compiler.compiler import main
- def parse_file(filename):
- try:
- main(util.get_code_path(filename), "grammars/actionlanguage.g", "N", [])
- return False
- except:
- return True
- 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"))
|