use of org.eclipse.ceylon.compiler.java.test.CompilerError in project ceylon by eclipse.
the class IssuesTests_1000_1499 method testBug1180.
@Test
public void testBug1180() {
compile("bug11xx/Bug1180_1.ceylon");
assertErrors("bug11xx/Bug1180_2", new CompilerError(25, "illegal argument types in invocation of overloaded method or class: there must be exactly one overloaded declaration of 'ArrayList' which accepts the given argument types '{Bug1180Person*}'"), new CompilerError(25, "class alias may not alias overloaded class"));
}
use of org.eclipse.ceylon.compiler.java.test.CompilerError in project ceylon by eclipse.
the class IssuesTests_7000_7499 method bug7072.
@Test
public void bug7072() {
compile(Arrays.asList("-overrides", "test/src/org/eclipse/ceylon/compiler/java/test/issues/bug70xx/bug7072/overrides.xml"), "bug70xx/bug7072/run.ceylon");
assertErrors("bug70xx/bug7072/run", Arrays.asList("-overrides", "test/src/org/eclipse/ceylon/compiler/java/test/issues/bug70xx/bug7072/overrides-bogus.xml"), null, new CompilerError(-1, new File("").getAbsolutePath() + "/test/src/org/eclipse/ceylon/compiler/java/test/issues/bug70xx/bug7072/overrides-bogus.xml:9:36: Element 'module > replace' accepts no child element (seen 'with')."));
}
use of org.eclipse.ceylon.compiler.java.test.CompilerError in project ceylon by eclipse.
the class RecoveryTests method testTako.
@Ignore("This test largely depends on modules that are now binary-incompatible")
@Test
public void testTako() throws IOException {
String subPath = "modules/bug1411";
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, subPath + "/dupdecl.ceylon", subPath + "/moduletest1/module.ceylon", subPath + "/moduletest1/package.ceylon", subPath + "/moduletest1/helloworld.ceylon", subPath + "/hello/hello.ceylon", subPath + "/hello/module.ceylon", subPath + "/hello/package.ceylon", subPath + "/testtest/module.ceylon", subPath + "/testtest/test.ceylon", subPath + "/sub/mod/module.ceylon", subPath + "/sub/mod/run.ceylon", subPath + "/sub/mod/package.ceylon", subPath + "/unknownmodule/module.ceylon", subPath + "/unknownmodule/run.ceylon", subPath + "/unknownmodule/package.ceylon", subPath + "/interop/module.ceylon", subPath + "/interop/interop.ceylon", subPath + "/jsonly/jsonly.ceylon", subPath + "/jsonly/module.ceylon", subPath + "/jsonly/package.ceylon", subPath + "/modulep/module.ceylon", subPath + "/modulep/main.ceylon", subPath + "/browser/dom/main.ceylon", subPath + "/browser/dom/package.ceylon", subPath + "/browser/module.ceylon", subPath + "/browser/main.ceylon", subPath + "/browser/package.ceylon", subPath + "/test/InheritanceAndBoxingTest.ceylon", subPath + "/test/ExceptionTest.ceylon", subPath + "/test/Foo.ceylon", subPath + "/test/GameOfLife.ceylon", subPath + "/test/Bar.ceylon", subPath + "/test/encoding.ceylon", subPath + "/test/helloworld.ceylon", subPath + "/swing/module.ceylon", subPath + "/swing/run.ceylon", subPath + "/swing/package.ceylon", subPath + "/interoprev/module.ceylon", subPath + "/interoprev/run.ceylon", subPath + "/interoprev/package.ceylon", subPath + "/java/hello.ceylon", subPath + "/java/module.ceylon", subPath + "/java/package.ceylon", subPath + "/helloworld.ceylon", subPath + "/wrongversion/module.ceylon", subPath + "/wrongversion/run.ceylon", subPath + "/wrongversion/package.ceylon", subPath + "/importhello/module.ceylon", subPath + "/importhello/helloworld.ceylon", subPath + "/usingimport.ceylon", // subPath + "/javaa/run.ceylon"
subPath + "/gavinprob/module.ceylon", subPath + "/gavinprob/main.ceylon", subPath + "/web_ide_script/module.ceylon", subPath + "/web_ide_script/hello_world.ceylon", subPath + "/timetest/module.ceylon", subPath + "/timetest/test.ceylon");
Boolean ret = task.call();
assertFalse(ret);
TreeSet<CompilerError> actualErrors = c.get(Diagnostic.Kind.ERROR);
compareErrors(actualErrors, new CompilerError(1, "package not found in imported modules: 'java.lang' (define a module and add module import to its module descriptor)"), new CompilerError(2, "source code imports two different versions of module 'ceylon.file': version '0.5' and version '1.1.0'"), new CompilerError(2, "cannot find module artifact 'fooxhilio.bastardo-77.9(.car|.jar)'\n" + " \t- dependency tree: 'unknownmodule/1.0.0' -> 'fooxhilio.bastardo/77.9'"), new CompilerError(4, "function or value is not defined: 'nanoTime' might be misspelled or is not imported"), new CompilerError(4, "type does not exist: 'Test'"), new CompilerError(4, "unsupported module name: this namespace is used by Java platform modules"), new CompilerError(5, "duplicate declaration name: 'run'"), new CompilerError(7, "duplicate declaration name: 'run'"), new CompilerError(10, "case must be a toplevel anonymous class: 'alive' is not toplevel"), new CompilerError(10, "case must be a toplevel anonymous class: 'dead' is not toplevel"), new CompilerError(10, "case must be a toplevel anonymous class: 'moribund' is not toplevel"), new CompilerError(10, "case must be a toplevel anonymous class: 'resurrected' is not toplevel"), new CompilerError(12, "imported declaration not found: 'newServer_bogus'"), new CompilerError(30, "function or value is not defined: 'newServer_bogus' might be misspelled or is not imported"), new CompilerError(135, "function or value is not defined: 'array' might be misspelled or is not imported"), new CompilerError(138, "could not determine type of function or value reference: 'cells'"), new CompilerError(139, "could not determine type of function or value reference: 'c'"), new CompilerError(140, "could not determine type of function or value reference: 'c'"));
File carFile = getModuleArchive("default", null);
assertTrue(carFile.exists());
String[] modules = new String[] { "swing/1.0.0", "web_ide_script/1.0.0", "browser/1.0.0", "timetest/1.0.0", "interop/1.0.0", "importhello/0.1", "interoprev/1.0.0", "modulep/0.1", "hello/1.0.0", "moduletest1/0.1", "jsonly/1.0.0", "testtest/1.1", "sub.mod/1.0.0" };
for (String module : modules) {
int sep = module.indexOf('/');
String name = module.substring(0, sep);
String version = module.substring(sep + 1);
carFile = getModuleArchive(name, version);
assertTrue("Module created car: " + module, carFile.exists());
}
}
use of org.eclipse.ceylon.compiler.java.test.CompilerError in project ceylon by eclipse.
the class RecoveryTests method testErrorSameCompilationUnit.
@Test
public void testErrorSameCompilationUnit() throws IOException {
String subPath = "modules/errorInSameCompilationUnit";
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, subPath + "/someok.ceylon");
Boolean ret = task.call();
assertFalse(ret);
TreeSet<CompilerError> actualErrors = c.get(Diagnostic.Kind.ERROR);
compareErrors(actualErrors, new CompilerError(23, "type is not defined: 'ERROR' might be misspelled or is not imported"));
File carFile = getModuleArchive("default", null);
assertTrue(carFile.exists());
JarFile car = new JarFile(carFile);
ZipEntry moduleClass = car.getEntry("a_.class");
assertNotNull(moduleClass);
car.close();
}
use of org.eclipse.ceylon.compiler.java.test.CompilerError in project ceylon by eclipse.
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: the name 'run' is not unique in this scope"));
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