diff options
| -rw-r--r-- | src/parser.rs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/parser.rs b/src/parser.rs index 1c21510..8df629d 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -646,6 +646,10 @@ where I::Error: ParseError<I::Item, I::Range, I::Position>, { or( + ( + blank(), + eof(), + ).map(|_| MapGroup::default()), definitions() .map(|definitions| { // MapGroup { @@ -679,7 +683,6 @@ where map_group }), - eof().map(|()| MapGroup::default()), ) } @@ -1373,6 +1376,19 @@ cmd <play> /usr/bin/say hello } #[test] + fn map_group_skipped_input_outputs_default_map_group() { + let text = " +# test + # a test + "; + let result = map_group().easy_parse(text).map(|t| t.0); + let expected = MapGroup::default(); + println!("{:?}", map_group().easy_parse(text).map(|t| t.1)); + + assert_eq!(result, Ok(expected)); + } + + #[test] fn map_group_with_invalid_input_fails() { let text = "not-a-kind <play> <Nop> "; |
