summaryrefslogtreecommitdiff
path: root/rust/src/parser.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rust/src/parser.rs')
-rw-r--r--rust/src/parser.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/rust/src/parser.rs b/rust/src/parser.rs
index c85a425..9dc0bb8 100644
--- a/rust/src/parser.rs
+++ b/rust/src/parser.rs
@@ -250,12 +250,19 @@ mod tests {
type Strategy = BoxedStrategy<Self>;
fn arbitrary_with(_args: ()) -> Self::Strategy {
- prop_oneof![
+ let identifier = "\\pL(\\pL|\\pN)*";
+ let leaf = prop_oneof![
any::<i32>().prop_map(Num),
any::<bool>().prop_map(Bool),
// see https://unicode.org/reports/tr18/#General_Category_Property for one letter unicode categories
- "\\pL(\\pL|\\pN)*".prop_map(Sym),
- ]
+ identifier.prop_map(Sym),
+ ];
+ leaf.prop_recursive(4, 128, 5, move |inner| {
+ prop_oneof![
+ (inner.clone(), inner.clone()).prop_map(|(l, r)| App(Box::new(l), Box::new(r))),
+ (identifier, inner).prop_map(|(var, body)| Lam(var, Box::new(body))),
+ ]
+ })
.boxed()
}
}