revset: add test of filter intersection over non-linear tree

Previously we only have a test for the left recursion. The added test
contains right recursion path, which should have caught the error I made
while working on the next "unary filter node" patch.
This commit is contained in:
Yuya Nishihara 2022-12-02 22:21:26 +09:00
parent 48d426529c
commit 6d977c73e4

View file

@ -2764,6 +2764,43 @@ mod tests {
),
}
"###);
insta::assert_debug_snapshot!(
optimize(parse("(a & author(A)) & ((b & author(B)) & (c & author(C))) & d").unwrap()),
@r###"
Filter {
candidates: Filter {
candidates: Filter {
candidates: Intersection(
Intersection(
Symbol(
"a",
),
Intersection(
Symbol(
"b",
),
Symbol(
"c",
),
),
),
Symbol(
"d",
),
),
predicate: Author(
"A",
),
},
predicate: Author(
"B",
),
},
predicate: Author(
"C",
),
}
"###);
// 'all()' moves in to 'filter()' first, so 'A & filter()' can be found.
insta::assert_debug_snapshot!(