Search in sources :

Example 21 with ErrorCollector

use of com.redhat.ceylon.compiler.java.test.ErrorCollector in project ceylon-compiler by ceylon.

the class IssuesTests_1500_1999 method testBug1631.

@Ignore("Used for benchmarking")
@Test
public void testBug1631() throws Exception {
    // System.err.println("Press enter to continue");
    // System.in.read();
    // System.err.println("Let's go");
    long totals = 0;
    int runs = 1;
    for (int i = 0; i < runs; i++) {
        long start = System.nanoTime();
        ErrorCollector c = new ErrorCollector();
        assertCompilesOk(c, getCompilerTask(Arrays.asList(/*"-verbose:benchmark", */
        "-out", destDir), c, "bug16xx/bug1631/run.ceylon").call2());
        // benchmarkParse("bug16xx/bug1631/run.ceylon");
        long end = System.nanoTime();
        long total = end - start;
        System.err.println("Took " + (total / 1_000_000) + "ms");
        totals += total;
    }
    System.err.println("Average " + ((totals / 1_000_000) / runs) + "ms");
// System.err.println("Press enter to quit");
// System.in.read();
// System.err.println("Done");
}
Also used : ErrorCollector(com.redhat.ceylon.compiler.java.test.ErrorCollector) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 22 with ErrorCollector

use of com.redhat.ceylon.compiler.java.test.ErrorCollector in project ceylon-compiler by ceylon.

the class IssuesTests_1500_1999 method testBug1836.

@Test
public void testBug1836() {
    ErrorCollector collector = new ErrorCollector();
    CeyloncTaskImpl task = getCompilerTask(defaultOptions, collector, "bug18xx/Bug1836.ceylon");
    ExitState call2 = task.call2();
    Assert.assertEquals(CeylonState.ERROR, call2.ceylonState);
    Assert.assertEquals(Main.EXIT_ERROR, call2.javacExitCode);
}
Also used : ExitState(com.redhat.ceylon.compiler.java.launcher.Main.ExitState) ErrorCollector(com.redhat.ceylon.compiler.java.test.ErrorCollector) CeyloncTaskImpl(com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl) Test(org.junit.Test)

Example 23 with ErrorCollector

use of com.redhat.ceylon.compiler.java.test.ErrorCollector in project ceylon-compiler by ceylon.

the class IssuesTests_1500_1999 method testBug1773.

@Test
public void testBug1773() {
    ErrorCollector collector = new ErrorCollector();
    CeyloncTaskImpl task = getCompilerTask(defaultOptions, collector, "bug17xx/Bug1773.ceylon");
    // now compile it all the way
    ExitState exitState = task.call2();
    Assert.assertEquals(ExitState.CeylonState.ERROR, exitState.ceylonState);
    // make sure we only got one, do not trust actualErrors.size() for that since it's a Set so
    // two methods with same contents would count as one.
    Assert.assertEquals(1, exitState.errorCount);
    TreeSet<CompilerError> actualErrors = collector.get(Diagnostic.Kind.ERROR);
    compareErrors(actualErrors, new CompilerError(22, "dynamic is not supported on the JVM"));
}
Also used : ExitState(com.redhat.ceylon.compiler.java.launcher.Main.ExitState) ErrorCollector(com.redhat.ceylon.compiler.java.test.ErrorCollector) CompilerError(com.redhat.ceylon.compiler.java.test.CompilerError) CeyloncTaskImpl(com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl) Test(org.junit.Test)

Example 24 with ErrorCollector

use of com.redhat.ceylon.compiler.java.test.ErrorCollector in project ceylon-compiler by ceylon.

the class IssuesTests_1500_1999 method testBug1830.

@Test
public void testBug1830() {
    ErrorCollector collector = new ErrorCollector();
    CeyloncTaskImpl task = getCompilerTask(defaultOptions, collector, "bug18xx/Bug1830.ceylon");
    ExitState call2 = task.call2();
    Assert.assertEquals(CeylonState.ERROR, call2.ceylonState);
    Assert.assertEquals(Main.EXIT_ERROR, call2.javacExitCode);
}
Also used : ExitState(com.redhat.ceylon.compiler.java.launcher.Main.ExitState) ErrorCollector(com.redhat.ceylon.compiler.java.test.ErrorCollector) CeyloncTaskImpl(com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl) Test(org.junit.Test)

Example 25 with ErrorCollector

use of com.redhat.ceylon.compiler.java.test.ErrorCollector in project ceylon-compiler by ceylon.

the class IssuesTests_1000_1499 method testBug1347.

@Test
public void testBug1347() {
    Assume.assumeTrue("Runs on JDK8", JDKUtils.jdk == JDKUtils.JDK.JDK8);
    assertErrors("bug13xx/bug1347/bug1347", Arrays.asList("-out", destDir, "-rep", "test/java8/modules"), null, new CompilerError(12, "call to a static interface member is not allowed unless you set the -target flag to 8: --javac=-target=8"), new CompilerError(14, "call to a static interface member is not allowed unless you set the -target flag to 8: --javac=-target=8"), new CompilerError(16, "call to a static interface member is not allowed unless you set the -target flag to 8: --javac=-target=8"), new CompilerError(28, "call to a static interface member is not allowed unless you set the -target flag to 8: --javac=-target=8"), new CompilerError(30, "call to a static interface member is not allowed unless you set the -target flag to 8: --javac=-target=8"));
    ErrorCollector c = new ErrorCollector();
    assertCompilesOk(c, getCompilerTask(Arrays.asList("-target", "8", "-out", destDir, "-rep", "test/java8/modules"), c, "bug13xx/bug1347/bug1347.ceylon").call2());
    run("com.redhat.ceylon.compiler.java.test.issues.bug13xx.bug1347.test", new ModuleWithArtifact("com.redhat.ceylon.compiler.java.test.issues.bug13xx.bug1347", "1"), new ModuleWithArtifact("com.ceylon.java8", "1", "test/java8/modules", "jar"));
}
Also used : CompilerError(com.redhat.ceylon.compiler.java.test.CompilerError) ErrorCollector(com.redhat.ceylon.compiler.java.test.ErrorCollector) Test(org.junit.Test)

Aggregations

ErrorCollector (com.redhat.ceylon.compiler.java.test.ErrorCollector)26 Test (org.junit.Test)23 CeyloncTaskImpl (com.redhat.ceylon.compiler.java.tools.CeyloncTaskImpl)18 CompilerError (com.redhat.ceylon.compiler.java.test.CompilerError)15 File (java.io.File)10 JarFile (java.util.jar.JarFile)7 LinkedList (java.util.LinkedList)6 ZipEntry (java.util.zip.ZipEntry)6 ArrayList (java.util.ArrayList)4 ExitState (com.redhat.ceylon.compiler.java.launcher.Main.ExitState)3 CeyloncFileManager (com.redhat.ceylon.compiler.java.tools.CeyloncFileManager)3 CeyloncTool (com.redhat.ceylon.compiler.java.tools.CeyloncTool)3 Module (com.redhat.ceylon.model.typechecker.model.Module)3 ZipFile (java.util.zip.ZipFile)2 Ignore (org.junit.Ignore)2 ModuleImport (com.redhat.ceylon.model.typechecker.model.ModuleImport)1 StringWriter (java.io.StringWriter)1