pegjs/test/unit/compiler/passes/report-duplicate-rules.spec.js
David Majda 6817f3b964 Tests: Require specific modules instead of the whole library
Requiring the whole library was a relict from the time where the tests
were exercising the browser build when run in the browser.
2016-12-16 13:21:48 +01:00

25 lines
624 B
JavaScript

"use strict";
let chai = require("chai");
let helpers = require("./helpers");
let pass = require("../../../../lib/compiler/passes/report-duplicate-rules");
chai.use(helpers);
let expect = chai.expect;
describe("compiler pass |reportDuplicateRules|", function() {
it("reports duplicate rules", function() {
expect(pass).to.reportError([
"start = 'a'",
"start = 'b'"
].join("\n"), {
message: "Rule \"start\" is already defined at line 1, column 1.",
location: {
start: { offset: 12, line: 2, column: 1 },
end: { offset: 23, line: 2, column: 12 }
}
});
});
});