Behavior specs cleanup: Don't describe named rules separately
While naming a rule creates a separate node on the AST level, it's not a new concept on the user level, so its specs should be a part of rule specs.
This commit is contained in:
parent
a597e65a66
commit
ce91921a1d
|
@ -178,21 +178,6 @@ describe("generated parser behavior", function() {
|
|||
});
|
||||
});
|
||||
|
||||
describe("named rule", function() {
|
||||
var parser = PEG.buildParser('start "start" = "a"');
|
||||
|
||||
it("delegates to the expression", function() {
|
||||
expect(parser).toParse("a", "a");
|
||||
expect(parser).toFailToParse("b");
|
||||
});
|
||||
|
||||
it("overwrites expected string on failure", function() {
|
||||
expect(parser).toFailToParse("b", {
|
||||
expected: [{ type: "other", description: "start" }]
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("rule", function() {
|
||||
var grammar = [
|
||||
'{ var n = 0; }',
|
||||
|
@ -213,6 +198,21 @@ describe("generated parser behavior", function() {
|
|||
expect(parser).toParse("ac", 2);
|
||||
});
|
||||
}
|
||||
|
||||
describe("named rule", function() {
|
||||
var parser = PEG.buildParser('start "start" = "a"');
|
||||
|
||||
it("delegates to the expression", function() {
|
||||
expect(parser).toParse("a", "a");
|
||||
expect(parser).toFailToParse("b");
|
||||
});
|
||||
|
||||
it("overwrites expected string on failure", function() {
|
||||
expect(parser).toFailToParse("b", {
|
||||
expected: [{ type: "other", description: "start" }]
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("literal", function() {
|
||||
|
|
Loading…
Reference in a new issue