Behavior specs cleanup: Improve one or more specs

redux
David Majda 10 years ago
parent b9a3b44cf2
commit bb708490a0

@ -645,15 +645,24 @@ 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() {
it("returns an array of its match results", function() {
var parser = PEG.buildParser('start = "a"+', options); 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("");
});
});
});
describe("text", function() { describe("text", function() {
it("matches correctly", function() { it("matches correctly", function() {
var parser = PEG.buildParser('start = $("a" "b" "c")', options); var parser = PEG.buildParser('start = $("a" "b" "c")', options);

Loading…
Cancel
Save