more tests for separated_by
This commit is contained in:
parent
5705876477
commit
7a832b6ba2
@ -220,5 +220,24 @@ mod tests {
|
|||||||
p.parse("garb garb garb garb").unwrap(),
|
p.parse("garb garb garb garb").unwrap(),
|
||||||
(vec![20, 20, 20, 20], "")
|
(vec![20, 20, 20, 20], "")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
assert!(p.parse("garb garb garb garb ").is_err());
|
||||||
|
|
||||||
|
let p =
|
||||||
|
repeated(literal("garb").to(20)).separated_by(repeated(literal(" ")).at_least(1), true);
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
p.parse("garb garb garb garb").unwrap(),
|
||||||
|
(vec![20, 20, 20, 20], "")
|
||||||
|
);
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
p.parse("garb garb garb garb ").unwrap(),
|
||||||
|
(vec![20, 20, 20, 20], "")
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
p.parse("garb garb garb garb q").unwrap(),
|
||||||
|
(vec![20, 20, 20, 20], "q")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user