Add test for multi-include

This commit is contained in:
Kaspar Emanuel 2017-10-05 19:55:07 +01:00
parent 1bf1c1f0f9
commit ceae390650
2 changed files with 15 additions and 1 deletions

@ -1 +1 @@
Subproject commit 0abb6e5feef2f4ebf80d5a0891c1ad709011b1c7
Subproject commit 7a13cbd325b1854b83dfe060224a2a4be5b04701

View File

@ -45,6 +45,20 @@ class TestNearley(unittest.TestCase):
parse('a')
parse('b')
def test_multi_include(self):
fn = os.path.join(NEARLEY_PATH, 'test/grammars/multi-include-test.ne')
with open(fn) as f:
grammar = f.read()
code = create_code_for_nearley_grammar(grammar, 'main', BUILTIN_PATH, os.path.dirname(fn))
d = {}
exec (code, d)
parse = d['parse']
parse('a')
parse('b')
parse('c')
if __name__ == '__main__':
unittest.main()