diff options
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/parcom_spec.cr | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/parcom_spec.cr b/spec/parcom_spec.cr index 11d2446..dde6f21 100644 --- a/spec/parcom_spec.cr +++ b/spec/parcom_spec.cr @@ -494,6 +494,16 @@ describe Many do result.value.should eq("aaa".chars) result.tokens.should eq(tokens[3..]) end + + it "stops parsing when the wapped parser succeeds without consuming any input" do + a_optional : Parser(Char, Char?) + a_optional = Optional.new(Token.new('a')) + tokens = Tokens.from_string("aaa") + result = Many(Char, Char?).new(a_optional).parse(tokens) + + result.value.should eq("aaa".chars) + result.tokens.should eq(tokens[3..]) + end end end |
