You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
650 B
JavaScript
27 lines
650 B
JavaScript
8 years ago
|
"use strict";
|
||
|
|
||
8 years ago
|
let chai = require("chai");
|
||
|
let helpers = require("./helpers");
|
||
8 years ago
|
let peg = require("../../../../lib/peg");
|
||
8 years ago
|
|
||
8 years ago
|
chai.use(helpers);
|
||
|
|
||
|
let expect = chai.expect;
|
||
|
|
||
8 years ago
|
describe("compiler pass |reportDuplicateRules|", function() {
|
||
8 years ago
|
let pass = peg.compiler.passes.check.reportDuplicateRules;
|
||
8 years ago
|
|
||
|
it("reports duplicate rules", function() {
|
||
8 years ago
|
expect(pass).to.reportError([
|
||
8 years ago
|
"start = 'a'",
|
||
|
"start = 'b'"
|
||
|
].join("\n"), {
|
||
8 years ago
|
message: "Rule \"start\" is already defined at line 1, column 1.",
|
||
8 years ago
|
location: {
|
||
8 years ago
|
start: { offset: 12, line: 2, column: 1 },
|
||
|
end: { offset: 23, line: 2, column: 12 }
|
||
8 years ago
|
}
|
||
|
});
|
||
|
});
|
||
|
});
|