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.
29 lines
712 B
JavaScript
29 lines
712 B
JavaScript
8 years ago
|
"use strict";
|
||
|
|
||
7 years ago
|
const chai = require( "chai" );
|
||
|
const helpers = require( "./helpers" );
|
||
6 years ago
|
const pass = require( "pegjs" ).compiler.passes.check.reportDuplicateRules;
|
||
7 years ago
|
|
||
|
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 }
|
||
|
}
|
||
|
} );
|
||
|
|
||
|
} );
|
||
|
|
||
|
} );
|