1b20aa5427
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'
36 lines
888 B
JavaScript
36 lines
888 B
JavaScript
"use strict";
|
|
|
|
const chai = require( "chai" );
|
|
const helpers = require( "./helpers" );
|
|
const pass = require( "pegjs-dev" ).compiler.passes.check.reportUndefinedRules;
|
|
|
|
chai.use( helpers );
|
|
|
|
const expect = chai.expect;
|
|
|
|
describe( "compiler pass |reportUndefinedRules|", function () {
|
|
|
|
it( "reports undefined rules", function () {
|
|
|
|
expect( pass ).to.reportError( "start = undefined", {
|
|
message: "Rule \"undefined\" is not defined.",
|
|
location: {
|
|
start: { offset: 8, line: 1, column: 9 },
|
|
end: { offset: 17, line: 1, column: 18 }
|
|
}
|
|
} );
|
|
|
|
} );
|
|
|
|
it( "checks allowedStartRules", function () {
|
|
|
|
expect( pass ).to.reportError( "start = 'a'", {
|
|
message: "Start rule \"missing\" is not defined."
|
|
}, {
|
|
allowedStartRules: [ "missing" ]
|
|
} );
|
|
|
|
} );
|
|
|
|
} );
|