Search in sources :

Example 6 with CeylonCompileTool

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

the class CompilerToolTests method testCompileKeywordsInModuleName.

@Test
public void testCompileKeywordsInModuleName() 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.keywords.long.module"));
    tool.run();
}
Also used : CeylonCompileTool(org.eclipse.ceylon.compiler.CeylonCompileTool) Test(org.junit.Test)

Example 7 with CeylonCompileTool

use of org.eclipse.ceylon.compiler.CeylonCompileTool 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 8 with CeylonCompileTool

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

the class CompilerToolTests method testCompileWithOomeException.

@Test
public void testCompileWithOomeException() 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.oome"));
    try {
        tool.run();
        Assert.fail("Tool should have thrown an exception");
    } catch (SystemErrorException x) {
        Assert.assertEquals("java.lang.OutOfMemoryError", x.getMessage());
    }
}
Also used : CeylonCompileTool(org.eclipse.ceylon.compiler.CeylonCompileTool) SystemErrorException(org.eclipse.ceylon.compiler.SystemErrorException) Test(org.junit.Test)

Example 9 with CeylonCompileTool

use of org.eclipse.ceylon.compiler.CeylonCompileTool 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 10 with CeylonCompileTool

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

the class CompilerToolTests method testBug1179.

@Test
public void testBug1179() throws Exception {
    ToolModel<CeylonCompileTool> model = pluginLoader.loadToolModel("compile");
    Assert.assertNotNull(model);
    try {
        CeylonCompileTool tool = pluginFactory.bindArguments(model, getMainTool(), toolOptions("--src=test/src", "3"));
        Assert.fail("Tool should have thrown an exception");
    } catch (OptionArgumentException x) {
        Assert.assertEquals("Invalid module name or source file: 3\n" + "Module names should not contain any version part.\n" + "Source file names should be given relative to the current directory.", x.getMessage());
    }
}
Also used : CeylonCompileTool(org.eclipse.ceylon.compiler.CeylonCompileTool) OptionArgumentException(org.eclipse.ceylon.common.tool.OptionArgumentException) Test(org.junit.Test)

Aggregations

CeylonCompileTool (org.eclipse.ceylon.compiler.CeylonCompileTool)29 Test (org.junit.Test)29 OptionArgumentException (org.eclipse.ceylon.common.tool.OptionArgumentException)8 CompilerErrorException (org.eclipse.ceylon.compiler.CompilerErrorException)6 File (java.io.File)4 JarFile (java.util.jar.JarFile)3 SystemErrorException (org.eclipse.ceylon.compiler.SystemErrorException)2 Path (java.nio.file.Path)1 ZipEntry (java.util.zip.ZipEntry)1 NonFatalToolMessage (org.eclipse.ceylon.common.tool.NonFatalToolMessage)1 InvalidOptionValueException (org.eclipse.ceylon.common.tool.OptionArgumentException.InvalidOptionValueException)1 ToolUsageError (org.eclipse.ceylon.common.tool.ToolUsageError)1 CeylonNewTool (org.eclipse.ceylon.tools.new_.CeylonNewTool)1