parse("var a = {,};", TRAILING_COMMA_MESSAGE);
}
private Node parse(String string, String... warnings) {
CompilerEnvirons environment = new CompilerEnvirons();
TestErrorReporter testErrorReporter = new TestErrorReporter(null, warnings);
environment.setErrorReporter(testErrorReporter);
environment.setParseJSDoc(true);
environment.setParseJSDocDocumentation(true);
Parser p = new Parser(environment, testErrorReporter);
Node script = p.parse(string, null, 0);
// verifying that all warnings were seen
assertTrue(testErrorReporter.hasEncounteredAllErrors());
assertTrue(testErrorReporter.hasEncounteredAllWarnings());
return script;
}