Search in sources :

Example 1 with CompilerErrorException

use of org.eclipse.ceylon.compiler.CompilerErrorException in project ceylon by eclipse.

the class CompilerToolTests method testBug1183.

@Test
public void testBug1183() throws Exception {
    ToolModel<CeylonCompileTool> model = pluginLoader.loadToolModel("compile");
    Assert.assertNotNull(model);
    CeylonCompileTool tool = pluginFactory.bindArguments(model, getMainTool(), toolOptions("--src=test/src", "org.eclipse.ceylon.tools.test.bug1183"));
    try {
        tool.run();
        Assert.fail("Tool should have thrown an exception");
    } catch (CompilerErrorException e) {
    // We expect this, not a FatalToolError
    }
}
Also used : CeylonCompileTool(org.eclipse.ceylon.compiler.CeylonCompileTool) CompilerErrorException(org.eclipse.ceylon.compiler.CompilerErrorException) Test(org.junit.Test)

Example 2 with CompilerErrorException

use of org.eclipse.ceylon.compiler.CompilerErrorException in project ceylon by eclipse.

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(), toolOptions("--src=test/src", "org.eclipse.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(org.eclipse.ceylon.compiler.CeylonCompileTool) CompilerErrorException(org.eclipse.ceylon.compiler.CompilerErrorException) Test(org.junit.Test)

Example 3 with CompilerErrorException

use of org.eclipse.ceylon.compiler.CompilerErrorException in project ceylon by eclipse.

the class CompilerToolTests method testCompileWithRuntimeException.

@Test
public void testCompileWithRuntimeException() throws Exception {
    ToolModel<CeylonCompileTool> model = pluginLoader.loadToolModel("compile");
    Assert.assertNotNull(model);
    CeylonCompileTool tool = pluginFactory.bindArguments(model, getMainTool(), toolOptions("--src=test/src", "org.eclipse.ceylon.tools.test.runtimeex"));
    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(org.eclipse.ceylon.compiler.CeylonCompileTool) CompilerErrorException(org.eclipse.ceylon.compiler.CompilerErrorException) Test(org.junit.Test)

Example 4 with CompilerErrorException

use of org.eclipse.ceylon.compiler.CompilerErrorException in project ceylon by eclipse.

the class CompilerToolTests method testCompileWithAnalysisErrors.

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

Example 5 with CompilerErrorException

use of org.eclipse.ceylon.compiler.CompilerErrorException in project ceylon by eclipse.

the class CompilerToolTests method testCompileWithSyntaxErrors.

@Test
public void testCompileWithSyntaxErrors() throws Exception {
    ToolModel<CeylonCompileTool> model = pluginLoader.loadToolModel("compile");
    Assert.assertNotNull(model);
    CeylonCompileTool tool = pluginFactory.bindArguments(model, getMainTool(), toolOptions("--src=test/src", "org.eclipse.ceylon.tools.test.syntax"));
    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(org.eclipse.ceylon.compiler.CeylonCompileTool) CompilerErrorException(org.eclipse.ceylon.compiler.CompilerErrorException) Test(org.junit.Test)

Aggregations

CeylonCompileTool (org.eclipse.ceylon.compiler.CeylonCompileTool)6 CompilerErrorException (org.eclipse.ceylon.compiler.CompilerErrorException)6 Test (org.junit.Test)6