Search in sources :

Example 6 with CompilerErrorException

use of com.redhat.ceylon.compiler.CompilerErrorException 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)

Aggregations

CeylonCompileTool (com.redhat.ceylon.compiler.CeylonCompileTool)6 CompilerErrorException (com.redhat.ceylon.compiler.CompilerErrorException)6 Test (org.junit.Test)6