Skip to content

Commit 7547758

Browse files
committed
Added tests for bugfix
1 parent 7fec983 commit 7547758

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/test_parser.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,19 @@ def test_resolve_ambiguity_with_shared_node2(self):
975975
tree = l.parse("")
976976
self.assertEqual(tree, Tree('start', [Tree('x', [])]))
977977

978+
979+
def test_consistent_derivation_order1(self):
980+
# Should return the same result for any hash-seed
981+
parser = Lark('''
982+
start: a a
983+
a: "." | b
984+
b: "."
985+
''', lexer=LEXER)
986+
987+
tree = parser.parse('..')
988+
n = Tree('a', [Tree('b', [])])
989+
assert tree == Tree('start', [n, n])
990+
978991
_NAME = "TestFullEarley" + LEXER.capitalize()
979992
_TestFullEarley.__name__ = _NAME
980993
globals()[_NAME] = _TestFullEarley

0 commit comments

Comments
 (0)