Search in sources :

Example 26 with CeylonCompileTool

use of com.redhat.ceylon.compiler.CeylonCompileTool in project ceylon-compiler by ceylon.

the class CompilerToolTests method testCompileWithErroneous.

@Test
public void testCompileWithErroneous() throws Exception {
    ToolModel<CeylonCompileTool> model = pluginLoader.loadToolModel("compile");
    Assert.assertNotNull(model);
    CeylonCompileTool tool = pluginFactory.bindArguments(model, getMainTool(), options("--src=test/src", "com.redhat.ceylon.tools.test.erroneous"));
    try {
        tool.run();
        Assert.fail("Tool should have thrown an exception");
    } catch (CompilerErrorException x) {
        Assert.assertEquals("There was 1 error", x.getMessage());
    } catch (Throwable t) {
        t.printStackTrace();
        Assert.fail("Unexpected exception");
    }
}
Also used : CeylonCompileTool(com.redhat.ceylon.compiler.CeylonCompileTool) CompilerErrorException(com.redhat.ceylon.compiler.CompilerErrorException) Test(org.junit.Test)

Example 27 with CeylonCompileTool

use of com.redhat.ceylon.compiler.CeylonCompileTool in project ceylon-compiler by ceylon.

the class CompilerToolTests method testCompileMultiple.

@Test
public void testCompileMultiple() throws Exception {
    File carFile1 = getModuleArchive("com.redhat.ceylon.tools.test.multiple.sub1", "1.0");
    carFile1.delete();
    File carFile2 = getModuleArchive("com.redhat.ceylon.tools.test.multiple.sûb2", "1.0");
    carFile2.delete();
    ToolModel<CeylonCompileTool> model = pluginLoader.loadToolModel("compile");
    Assert.assertNotNull(model);
    CeylonCompileTool tool = pluginFactory.bindArguments(model, getMainTool(), options("--src=test/src", "com.redhat.ceylon.tools.test.multiple.*"));
    tool.run();
    assertTrue(carFile1.exists() && carFile2.exists());
}
Also used : CeylonCompileTool(com.redhat.ceylon.compiler.CeylonCompileTool) JarFile(java.util.jar.JarFile) File(java.io.File) Test(org.junit.Test)

Aggregations

CeylonCompileTool (com.redhat.ceylon.compiler.CeylonCompileTool)27 Test (org.junit.Test)27 OptionArgumentException (com.redhat.ceylon.common.tool.OptionArgumentException)8 CompilerErrorException (com.redhat.ceylon.compiler.CompilerErrorException)6 File (java.io.File)4 JarFile (java.util.jar.JarFile)3 ToolUsageError (com.redhat.ceylon.common.tool.ToolUsageError)2 SystemErrorException (com.redhat.ceylon.compiler.SystemErrorException)2 Path (java.nio.file.Path)1 ZipEntry (java.util.zip.ZipEntry)1