import unittest from crowbar_reference_compiler import compile_to_ssa, load_declarations, parse_header, parse_implementation, scan class TestDeclarationLoading(unittest.TestCase): def test_kitchen_sink(self): code = r""" struct normal { bool fake; } opaque struct ope; enum sample { Testing, } union robust { enum sample tag; switch (tag) { case Testing: bool testPassed; } } fragile union not_robust { int8 sample; bool nope; } """ tokens = scan(code) parse_tree = parse_header(tokens) decls = load_declarations(parse_tree) self.assertListEqual(decls, ['struct normal', 'struct ope', 'enum sample', 'union robust', 'union not_robust']) if __name__ == '__main__': unittest.main()