Test for duplicate symbols/macros (#1955)

* Test for duplicate symbols/macros

We've had a few cases where we accidentally include the same symbol or macro
definition in both macros.js and symbols.js.  This new test automatically
detects these scenarios during Jest testing.

* Fix lint errors
This commit is contained in:
Erik Demaine
2019-04-28 19:52:39 -04:00
committed by Kevin Barabash
parent 664dc6ab74
commit 5aad8f9f32

22
test/dup-spec.js Normal file
View File

@@ -0,0 +1,22 @@
/* global expect: false */
/* global it: false */
/* global describe: false */
import symbols from '../src/symbols.js';
import macros from '../src/macros.js';
describe("Symbols and macros", () => {
for (const macro in macros) {
if (!macros.hasOwnProperty(macro)) {
continue;
}
it(`macro ${macro} should not shadow a symbol`, () => {
for (const kind in symbols) {
if (!symbols.hasOwnProperty(kind)) {
continue;
}
expect(symbols[kind][macro]).toBeFalsy();
}
});
}
});