Behavior specs cleanup: Improve one or more specs

redux
David Majda 10 years ago
parent b9a3b44cf2
commit bb708490a0

@ -645,12 +645,21 @@ describe("generated parser behavior", function() {
});
describe("one or more", function() {
it("matches correctly", function() {
var parser = PEG.buildParser('start = "a"+', options);
describe("when the expression matches one or more times", function() {
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("aaa", ["a", "a", "a"]);
expect(parser).toParse("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