Skip to content

Commit 92e504c

Browse files
committed
Add breaking test case
1 parent 8c07952 commit 92e504c

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/descriptor/tr.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,3 +745,32 @@ where
745745
}
746746
}
747747
}
748+
749+
#[cfg(test)]
750+
mod tests {
751+
use super::*;
752+
use ForEachKey;
753+
754+
#[test]
755+
fn test_for_each() {
756+
let desc = "tr(acc0, {
757+
multi_a(3, acc10, acc11, acc12), {
758+
and_v(
759+
v:multi_a(2, acc10, acc11, acc12),
760+
after(10)
761+
),
762+
and_v(
763+
v:multi_a(1, acc10, acc11, ac12),
764+
after(100)
765+
)
766+
}
767+
})";
768+
let desc = desc.replace(&[' ', '\n'][..], "");
769+
let tr = Tr::<String>::from_str(&desc).unwrap();
770+
// Note the last ac12 only has ac and fails the predicate
771+
assert!(!tr.for_each_key(|k| match k {
772+
ForEach::Key(k) => k.starts_with("acc"),
773+
ForEach::Hash(_h) => unreachable!(),
774+
}));
775+
}
776+
}

0 commit comments

Comments
 (0)