Skip to content

Commit

Permalink
separated_list1_test: add empty_both
Browse files Browse the repository at this point in the history
  • Loading branch information
SaltyKitkat committed Nov 13, 2024
1 parent ac48579 commit 587ba95
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/multi/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ fn separated_list1_test() {
fn multi_longsep(i: &[u8]) -> IResult<&[u8], Vec<&[u8]>> {
separated_list1(tag(".."), tag("abcd")).parse(i)
}
fn empty_both(i: &[u8]) -> IResult<&[u8], Vec<&[u8]>> {
separated_list0(tag(""), tag("")).parse(i)
}

let a = &b"abcdef"[..];
let b = &b"abcd,abcdef"[..];
Expand All @@ -100,6 +103,10 @@ fn separated_list1_test() {
multi(c),
Err(Err::Error(error_position!(c, ErrorKind::Tag)))
);
assert_eq!(
empty_both(f),
Err(Err::Error(error_position!(f, ErrorKind::SeparatedList)))
);
let res3 = vec![&b"abcd"[..], &b"abcd"[..]];
assert_eq!(multi(d), Ok((&b",ef"[..], res3)));

Expand Down

0 comments on commit 587ba95

Please sign in to comment.