Behavior specs cleanup: Improve one or more specs

redux
David Majda 9 years ago
parent b9a3b44cf2
commit bb708490a0

@ -645,12 +645,21 @@ describe("generated parser behavior", function() {
}); });
describe("one or more", function() { describe("one or more", function() {
it("matches correctly", function() { describe("when the expression matches one or more times", function() {
var parser = PEG.buildParser('start = "a"+', options); it("returns an array of its match results", function() {
var parser = PEG.buildParser('start = "a"+', options);
expect(parser).toFailToParse(""); expect(parser).toParse("a", ["a"]);
expect(parser).toParse("a", ["a"]); expect(parser).toParse("aaa", ["a", "a", "a"]);
expect(parser).toParse("aaa", ["a", "a", "a"]); });
});
describe("when the expression doesn't match", function() {
it("reports match failure", function() {
var parser = PEG.buildParser('start = "a"+', options);
expect(parser).toFailToParse("");
});
}); });
}); });

Loading…
Cancel
Save