fix duplicated test names

previously test cases with the same name would be skipped except for the last one

`test/run-test.js` will now report duplicated names as errors

closes #1461
This commit is contained in:
alexlamsl
2017-02-18 19:15:09 +08:00
parent 6ffbecb72b
commit c525a2b190
4 changed files with 97 additions and 4 deletions

View File

@@ -194,6 +194,9 @@ function parse_test(file) {
if (node instanceof U.AST_LabeledStatement
&& tw.parent() instanceof U.AST_Toplevel) {
var name = node.label.name;
if (name in tests) {
throw new Error('Duplicated test name "' + name + '" in ' + file);
}
tests[name] = get_one_test(name, node.body);
return true;
}