use of org.eclipse.ceylon.compiler.java.test.CompilerError in project ceylon by eclipse.
the class CMRHTTPTests method assertTimeout.
private void assertTimeout(String[] files, List<String> options) {
ErrorCollector collector = compileErrorTest(files, options, null, false, true);
Set<CompilerError> errors = collector.get(Diagnostic.Kind.ERROR);
Assert.assertTrue("Expecting a single error, got " + errors.size(), errors.size() == 1);
CompilerError err = errors.iterator().next();
Assert.assertTrue("Expecting a java.net.SocketTimeoutException, got " + err, err.toString().contains("java.net.SocketTimeoutException"));
}
use of org.eclipse.ceylon.compiler.java.test.CompilerError in project ceylon by eclipse.
the class ExpressionTests method testLitNumericLiteral.
@Test
public void testLitNumericLiteral() {
compareWithJavaSource("literal/NumericLiteral");
assertErrors("literal/NumericLiteralErrors", new CompilerError(24, "literal outside representable range: '9223372036854775808' is too large to be represented as an 'Integer'"), new CompilerError(25, "literal outside representable range: '-9223372036854775809' is too large to be represented as an 'Integer'"), new CompilerError(27, "literal so large it is indistinguishable from infinity: '1.7976931348623159E308' (use infinity)"), new CompilerError(28, "literal so large it is indistinguishable from infinity: '1.7976931348623159E308' (use infinity)"), CompilerError.warning(29, "literal so small it is indistinguishable from zero: '2.0E-324' (use 0.0)"), CompilerError.warning(30, "literal so small it is indistinguishable from zero: '2.0E-324' (use 0.0)"), new CompilerError(34, "invalid hexadecimal literal: '#CAFEBABECAFEBABE1' has more than 64 bits"), new CompilerError(36, "invalid binary literal: '$11011101110111011101110111011101110111011101110111011101110111011' has more than 64 bits"));
/*assertErrors("literal/NumericLiteralParserErrors",
new CompilerError(23, "incorrect syntax: no viable alternative at character '-'"),
new CompilerError(24, "incorrect syntax: no viable alternative at character '+'"),
new CompilerError(25, "incorrect syntax: no viable alternative at character '-'"),
new CompilerError(26, "incorrect syntax: no viable alternative at character 's'"),
new CompilerError(28, "incorrect syntax: mismatched character '-' expecting set null"),
new CompilerError(29, "incorrect syntax: mismatched character '+' expecting set null"),
new CompilerError(30, "incorrect syntax: extraneous token '23' expecting statement-ending ';'"),
new CompilerError(31, "incorrect syntax: mismatched character 's' expecting set null")
);*/
}
use of org.eclipse.ceylon.compiler.java.test.CompilerError in project ceylon by eclipse.
the class RecoveryTests method testMissingImport.
@Test
public void testMissingImport() throws IOException {
String subPath = "modules/missingImport";
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 + "/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'"));
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");
assertFalse(carFile.exists());
}
use of org.eclipse.ceylon.compiler.java.test.CompilerError in project ceylon by eclipse.
the class RecoveryTests method testSyntaxErrorInModule.
@Test
public void testSyntaxErrorInModule() throws IOException {
String subPath = "modules/syntaxErrorInModule";
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 + "/someok.ceylon");
Boolean ret = task.call();
assertFalse(ret);
TreeSet<CompilerError> actualErrors = c.get(Diagnostic.Kind.ERROR);
compareErrors(actualErrors, new CompilerError(20, "incorrect syntax: missing ':' operator at '\"1.0.0\"'"));
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");
assertFalse(carFile.exists());
}
use of org.eclipse.ceylon.compiler.java.test.CompilerError in project ceylon by eclipse.
the class ReportingTests method testAnnoAlreadySuppressed2.
@Test
public void testAnnoAlreadySuppressed2() {
//
defaultOptions.add("-suppress-warnings");
defaultOptions.add("unusedDeclaration");
assertErrors(new String[] { "AlreadySuppressed.ceylon" }, defaultOptions, null, new CompilerError(Kind.WARNING, "", 3, "warnings already suppressed by annotation"));
}
Aggregations