Behavior specs cleanup: Add group specs
While groups don't create separate nodes on the AST level, they exist as concept on the user level, so they should be specified.
This commit is contained in:
parent
e306b58443
commit
73795a65cc
|
@ -598,6 +598,24 @@ describe("generated parser behavior", function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("group", function() {
|
||||||
|
describe("when the expression matches", function() {
|
||||||
|
it("returns its match result", function() {
|
||||||
|
var parser = PEG.buildParser('start = ("a")', options);
|
||||||
|
|
||||||
|
expect(parser).toParse("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("b");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("optional", function() {
|
describe("optional", function() {
|
||||||
describe("when the expression matches", function() {
|
describe("when the expression matches", function() {
|
||||||
it("returns its match result", function() {
|
it("returns its match result", function() {
|
||||||
|
|
Loading…
Reference in a new issue