Fixed infinite recursion when parsing complex BNF node
This commit is contained in:
@@ -103,3 +103,21 @@ def test_global_hits_are_global_even_when_empty():
|
||||
|
||||
assert a.global_hints == {"global hint 2"}
|
||||
assert b.global_hints == {"global hint 2"}
|
||||
|
||||
|
||||
def test_i_can_search():
|
||||
a = ExecutionContext("foo", Event("event_1"), "fake_sheerka", BuiltinConcepts.TESTING, "a")
|
||||
ab = a.push(BuiltinConcepts.TESTING, "ab", obj="obj_ab")
|
||||
ac = a.push(BuiltinConcepts.TESTING, "ac", obj="obj_ac")
|
||||
abb = ab.push(BuiltinConcepts.TESTING, "abb", obj="skip")
|
||||
abbb = abb.push(BuiltinConcepts.TESTING, "abbb", obj="obj_abbb")
|
||||
|
||||
assert list(abbb.search()) == [abb, ab, a]
|
||||
assert list(abbb.search(start_with_self=True)) == [abbb, abb, ab, a]
|
||||
assert list(abbb.search(lambda ec: ec.obj != "skip")) == [ab, a]
|
||||
assert list(abbb.search(lambda ec: ec.obj != "skip", lambda ec: ec.action_context)) == ["ab", "a"]
|
||||
assert list(abbb.search(stop=lambda ec: ec.obj == "skip")) == []
|
||||
assert list(abbb.search(
|
||||
stop=lambda ec: ec.obj == "skip",
|
||||
start_with_self=True,
|
||||
get_obj=lambda ec: ec.obj)) == ["obj_abbb"]
|
||||
|
||||
Reference in New Issue
Block a user