use of com.redhat.ceylon.compiler.java.test.ErrorCollector in project ceylon-compiler by ceylon.
the class RecoveryTests method testDuplicateInDefault.
@Test
public void testDuplicateInDefault() throws IOException {
String subPath = "modules/duplicateInDefault";
String srcPath = getPackagePath() + subPath;
List<String> options = new LinkedList<String>();
options.add("-src");
options.add(srcPath);
options.addAll(defaultOptions);
options.add("-continue");
ErrorCollector c = new ErrorCollector();
CeyloncTaskImpl task = getCompilerTask(options, c, Arrays.asList("okmodule"), subPath + "/dupdeclerr1.ceylon", subPath + "/dupdeclerr2.ceylon", subPath + "/someok.ceylon");
Boolean ret = task.call();
assertFalse(ret);
TreeSet<CompilerError> actualErrors = c.get(Diagnostic.Kind.ERROR);
compareErrors(actualErrors, // new CompilerError(21, "cannot find module artifact notfound-1(.car|.jar)\n \t- dependency tree: okmodule/1.0.0 -> notfound/1"),
new CompilerError(20, "duplicate declaration name: 'run'"));
File carFile = getModuleArchive("default", null);
assertTrue(carFile.exists());
JarFile car = new JarFile(carFile);
ZipEntry moduleClass = car.getEntry("foobar_.class");
assertNotNull(moduleClass);
car.close();
carFile = getModuleArchive("okmodule", "1.0.0");
assertTrue(carFile.exists());
car = new JarFile(carFile);
moduleClass = car.getEntry("okmodule/$module_.class");
assertNotNull(moduleClass);
car.close();
}
Aggregations