2016-06-22 15:02:59 +02:00
|
|
|
"use strict";
|
|
|
|
|
2017-10-25 20:19:42 +02:00
|
|
|
const chai = require( "chai" );
|
|
|
|
const helpers = require( "./helpers" );
|
2017-12-28 02:48:01 +01:00
|
|
|
const pass = require( "pegjs-dev" ).compiler.passes.check.reportDuplicateRules;
|
2017-10-25 20:19:42 +02:00
|
|
|
|
|
|
|
chai.use( helpers );
|
|
|
|
|
|
|
|
const 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 }
|
|
|
|
}
|
|
|
|
} );
|
|
|
|
|
|
|
|
} );
|
|
|
|
|
|
|
|
} );
|