Add tests and fix for package name override.

This commit is contained in:
A Pottinger
2019-10-13 14:37:15 -07:00
parent d57b4ac61b
commit 1fc326383e
5 changed files with 65 additions and 11 deletions

View File

@@ -88,8 +88,12 @@ public class ParserTests {
}
static void expectGood(final String id, boolean ignoreWhitespace) {
expectGood(id, ignoreWhitespace, Optional.empty());
}
static void expectGood(final String id, boolean ignoreWhitespace, Optional<String> packageName) {
try {
final String program = preprocess(id, res(id + ".pde"));
final String program = preprocess(id, res(id + ".pde"), packageName);
boolean successful = compile(id, program);
if (successful) {
System.err.println("----------------------------");
@@ -368,6 +372,11 @@ public class ParserTests {
expectGood("typeinference");
}
@Test
public void testPackage() {
expectGood("packageTest", true, Optional.of("test.subtest"));
}
private static boolean compile(String id, String program) {
// Create compilable AST to get syntax problems
CompilationUnit compilableCU = JdtCompilerUtil.makeAST(