pegjs/test/spec/unit/compiler/passes/report-duplicate-rules.spec.js
Futago-za Ryuu 1b20aa5427 Ensure usage of 'lib/peg.d.ts'
This commit ensures that all modules outside 'lib' are importing 'lib/peg.js' so that VS Code automatically gets 'lib/peg.d.ts'.

An alias module for 'lib/peg.js' called 'pegjs-dev' was made for test files at 'test/node_modules/pegjs-dev.js'
2017-12-28 01:48:01 +00:00

29 lines
716 B
JavaScript

"use strict";
const chai = require( "chai" );
const helpers = require( "./helpers" );
const pass = require( "pegjs-dev" ).compiler.passes.check.reportDuplicateRules;
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 }
}
} );
} );
} );