Behavior specs cleanup: Improve label specs
This commit is contained in:
parent
c5c44b9d0c
commit
52144e48cb
|
@ -724,13 +724,22 @@ describe("generated parser behavior", function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("label", function() {
|
describe("label", function() {
|
||||||
it("delegates to the expression", function() {
|
describe("when the expression matches", function() {
|
||||||
|
it("returns its match result", function() {
|
||||||
var parser = PEG.buildParser('start = a:"a"', options);
|
var parser = PEG.buildParser('start = a:"a"', options);
|
||||||
|
|
||||||
expect(parser).toParse("a", "a");
|
expect(parser).toParse("a", "a");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("when the expression doesn't match", function() {
|
||||||
|
it("reports match failure", function() {
|
||||||
|
var parser = PEG.buildParser('start = a:"a"', options);
|
||||||
|
|
||||||
expect(parser).toFailToParse("b");
|
expect(parser).toFailToParse("b");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("sequence", function() {
|
describe("sequence", function() {
|
||||||
it("matches correctly", function() {
|
it("matches correctly", function() {
|
||||||
|
|
Loading…
Reference in a new issue