Open
Description
In updating one of my projects to nom 8, I noticed one of my tests started failing. I narrowed it down to the combination of nom::combinator::recognize
and nom::character::complete::multispace0
being broken if multispace0
consumes the entire input.
In more detail, when adding the following test to src/combinator/tests.rs
, cases A-C pass, but case D fails. This seems to have worked correctly in nom 7.
#[test]
fn recognize_issue() {
use crate::character::complete::{multispace0, multispace1};
let input = "\na";
// Case A
assert_eq!(
recognize::<_, crate::error::Error<_>, _>(multispace1).parse(input),
Ok(("a", "\n"))
);
// Case B
assert_eq!(
recognize::<_, crate::error::Error<_>, _>(multispace0).parse(input),
Ok(("a", "\n"))
);
let input = "\n";
// Case C
assert_eq!(
recognize::<_, crate::error::Error<_>, _>(multispace1).parse(input),
Ok(("", "\n"))
);
// Case D
assert_eq!(
recognize::<_, crate::error::Error<_>, _>(multispace0).parse(input),
Ok(("", "\n"))
);
}
Metadata
Metadata
Assignees
Labels
No labels