From bffaca4d683b768a1564be762e2cd89dd2982210 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Fri, 26 Jan 2024 00:23:21 -0800 Subject: [PATCH] combinators --- src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index c4c9db1..795d9de 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -67,4 +67,11 @@ mod tests { let output = parser.parse("abcd").unwrap(); assert_eq!((59, "cd"), output); } + + #[test] + fn test_combinators() { + let parser = sequence(map(repeated(literal_char('a')), |_| 10), literal_char('b')); + let output = parser.parse("aaaaaaaabcd").unwrap(); + assert_eq! {((10, 'b'), "cd"), output}; + } }