Skip to content

Commit

Permalink
Fixed issue rust-bakery#721
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Zivota authored and Geal committed Mar 26, 2018
1 parent c58f214 commit 662c872
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ macro_rules! parse_to (

let res: Option<$t> = ($i).parse_to();
match res {
Some(output) => Ok(($i.slice(..$i.input_len()), output)),
Some(output) => Ok(($i.slice($i.input_len()..), output)),
None => Err(Err::Error(Context::Code($i, ErrorKind::MapOpt::<u32>)))
}
}
Expand Down
6 changes: 6 additions & 0 deletions tests/issues.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,9 @@ fn issue_667() {
Ok((CompleteByteSlice(b"!@#$"), vec![]))
);
}

#[test]
fn issue_721() {
assert_eq!(parse_to!("1234", u16), Ok(("", 1234)));
assert_eq!(parse_to!("foo", String), Ok(("", "foo".to_string())));
}

0 comments on commit 662c872

Please sign in to comment.