2016-06-22 15:02:59 +02:00
|
|
|
"use strict";
|
|
|
|
|
2016-12-08 08:59:04 +01:00
|
|
|
let chai = require("chai");
|
|
|
|
let helpers = require("./helpers");
|
2016-12-16 13:21:48 +01:00
|
|
|
let pass = require("../../../../lib/compiler/passes/report-duplicate-rules");
|
2016-09-08 13:29:06 +02:00
|
|
|
|
2016-12-08 08:59:04 +01:00
|
|
|
chai.use(helpers);
|
|
|
|
|
|
|
|
let expect = chai.expect;
|
|
|
|
|
2016-06-22 15:02:59 +02:00
|
|
|
describe("compiler pass |reportDuplicateRules|", function() {
|
|
|
|
it("reports duplicate rules", function() {
|
2016-12-08 08:59:04 +01:00
|
|
|
expect(pass).to.reportError([
|
2016-09-21 15:06:56 +02:00
|
|
|
"start = 'a'",
|
|
|
|
"start = 'b'"
|
|
|
|
].join("\n"), {
|
2016-09-22 05:25:09 +02:00
|
|
|
message: "Rule \"start\" is already defined at line 1, column 1.",
|
2016-06-22 15:02:59 +02:00
|
|
|
location: {
|
2016-09-22 05:25:09 +02:00
|
|
|
start: { offset: 12, line: 2, column: 1 },
|
|
|
|
end: { offset: 23, line: 2, column: 12 }
|
2016-06-22 15:02:59 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|