combinators
This commit is contained in:
parent
97d35df687
commit
bffaca4d68
@ -67,4 +67,11 @@ mod tests {
|
|||||||
let output = parser.parse("abcd").unwrap();
|
let output = parser.parse("abcd").unwrap();
|
||||||
assert_eq!((59, "cd"), output);
|
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};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user