Skip to content

Commit

Permalink
Merge pull request #547 from ordian/master
Browse files Browse the repository at this point in the history
fix(alt_complete): alt_complete! should never return incomplete
  • Loading branch information
Geal authored Sep 21, 2017
2 parents b918642 + 4df732f commit 628e012
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/branch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,15 +327,15 @@ macro_rules! alt_complete (
);

($i:expr, $subrule:ident!( $($args:tt)* ) => { $gen:expr }) => (
alt!(__impl $i, $subrule!($($args)*) => { $gen } | __end)
alt!(__impl $i, complete!($subrule!($($args)*)) => { $gen } | __end)
);

($i:expr, $e:ident) => (
alt_complete!($i, call!($e));
);

($i:expr, $subrule:ident!( $($args:tt)*)) => (
alt!(__impl $i, $subrule!($($args)*) | __end)
alt!(__impl $i, complete!($subrule!($($args)*)) | __end)
);
);

Expand Down Expand Up @@ -813,7 +813,7 @@ mod tests {
);

let a = &b""[..];
assert_eq!(ac(a), Incomplete(Needed::Size(2)));
assert_eq!(ac(a), Error(error_position!(ErrorKind::Alt, a)));
let a = &b"ef"[..];
assert_eq!(ac(a), Done(&b""[..], &b"ef"[..]));
let a = &b"cde"[..];
Expand Down

0 comments on commit 628e012

Please sign in to comment.