Skip to content

Commit

Permalink
fix the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Geal committed Jan 15, 2023
1 parent 5807d79 commit 31936ee
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,19 +484,19 @@ mod test {
};
}

/*#[test]
#[test]
#[cfg(feature = "alloc")]
fn recognize_is_a() {
let a = "aabbab";
let b = "ababcd";

fn f(i: &str) -> IResult<&str, &str> {
recognize(many(1.., alt((tag("a"), tag("b")))))(i)
recognize::<_, Vec<&str>, _, _>(many(1.., alt((tag("a"), tag("b")))))(i)
}

assert_eq!(f(a), Ok((&a[6..], a)));
assert_eq!(f(b), Ok((&b[4..], &b[..4])));
}*/
}

#[test]
fn utf8_indexing() {
Expand Down
2 changes: 1 addition & 1 deletion tests/fnmut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fn parse() {
let mut counter = 0;

let res = {
let mut parser = many::<_, _, (), _, _>(0.., |i| {
let mut parser = many::<_, _, (), Vec<&str>, _, _>(0.., |i| {
counter += 1;
tag("abc")(i)
});
Expand Down
4 changes: 1 addition & 3 deletions tests/ini.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ fn key_value(i: &[u8]) -> IResult<&[u8], (&str, &str)> {
}

fn keys_and_values(i: &[u8]) -> IResult<&[u8], HashMap<&str, &str>> {
map(many(0.., terminated(key_value, opt(multispace))), |vec| {
vec.into_iter().collect()
})(i)
many(0.., terminated(key_value, opt(multispace)))(i)
}

fn category_and_keys(i: &[u8]) -> IResult<&[u8], (&str, HashMap<&str, &str>)> {
Expand Down
2 changes: 1 addition & 1 deletion tests/issues.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ fn issue_942() {
fn issue_many_m_n_with_zeros() {
use nom::character::complete::char;
use nom::multi::many;
let mut parser = many::<_, _, (), _, _>(0..=0, char('a'));
let mut parser = many::<_, _, (), Vec<char>, _, _>(0..=0, char('a'));
assert_eq!(parser("aaa"), Ok(("aaa", vec!())));
}

Expand Down

0 comments on commit 31936ee

Please sign in to comment.