From 7547758e21bd99c70df01eaa6cbaaf4db1af05b2 Mon Sep 17 00:00:00 2001 From: Erez Shinan Date: Sun, 30 Jun 2024 22:37:43 +0200 Subject: [PATCH] Added tests for bugfix --- tests/test_parser.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/test_parser.py b/tests/test_parser.py index 13124a0d..5a0d405d 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -975,6 +975,19 @@ def test_resolve_ambiguity_with_shared_node2(self): tree = l.parse("") self.assertEqual(tree, Tree('start', [Tree('x', [])])) + + def test_consistent_derivation_order1(self): + # Should return the same result for any hash-seed + parser = Lark(''' + start: a a + a: "." | b + b: "." + ''', lexer=LEXER) + + tree = parser.parse('..') + n = Tree('a', [Tree('b', [])]) + assert tree == Tree('start', [n, n]) + _NAME = "TestFullEarley" + LEXER.capitalize() _TestFullEarley.__name__ = _NAME globals()[_NAME] = _TestFullEarley