improve test/reduce (#3710)

- suppress several instances of malformed AST generation
- improve resilience & reporting against malformed ASTs
This commit is contained in:
Alex Lam S.L
2020-02-09 08:07:55 +00:00
committed by GitHub
parent 44499a6643
commit 70551febc8
2 changed files with 108 additions and 42 deletions

View File

@@ -57,4 +57,10 @@ describe("test/reduce.js", function() {
assert.ok(err instanceof Error);
assert.strictEqual(err.stack.split(/\n/)[0], "DefaultsError: `unsafe_regex` is not a supported option");
});
it("Should report on test case with invalid syntax", function() {
var result = reduce_test("var 0 = 1;");
var err = result.error;
assert.ok(err instanceof Error);
assert.strictEqual(err.stack.split(/\n/)[0], "SyntaxError: Name expected");
});
});