Skip to content

Commit

Permalink
test(token): Verify empty until behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Feb 28, 2024
1 parent d6d1124 commit f417ec2
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/token/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,21 @@ fn complete_take_until() {
);
}

#[test]
fn complete_take_until_empty() {
fn take_until_empty(i: &str) -> IResult<&str, &str> {
take_until(0, "").parse_peek(i)
}
#[cfg(not(feature = "simd"))]
assert_eq!(
take_until_empty(""),
Err(ErrMode::Backtrack(error_position!(&"", ErrorKind::Slice)))
);
#[cfg(feature = "simd")]
assert_eq!(take_until_empty(""), Ok(("", "")));
assert_eq!(take_until_empty("end"), Ok(("end", "")));
}

#[test]
fn complete_literal_case_insensitive() {
fn caseless_bytes(i: &[u8]) -> IResult<&[u8], &[u8]> {
Expand Down

0 comments on commit f417ec2

Please sign in to comment.