Search in sources :

Example 21 with CeylonCompileTool

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

the class CompilerToolTests method testDefaultModuleNoFiles.

@Test
public void testDefaultModuleNoFiles() throws Exception {
    ToolModel<CeylonCompileTool> model = pluginLoader.loadToolModel("compile");
    Assert.assertNotNull(model);
    try {
        CeylonCompileTool tool = pluginFactory.bindArguments(model, getMainTool(), toolOptions("--src=test/src/org/eclipse/ceylon/tools/test/empty", "default"));
        tool.run();
        Assert.fail("Tool should have thrown an exception");
    } catch (ToolUsageError e) {
        Assert.assertEquals("Module default does not contain any sources or resources", e.getMessage());
    }
}
Also used : CeylonCompileTool(org.eclipse.ceylon.compiler.CeylonCompileTool) ToolUsageError(org.eclipse.ceylon.common.tool.ToolUsageError) Test(org.junit.Test)

Example 22 with CeylonCompileTool

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

the class CompilerToolTests method testTarget.

@Test
public void testTarget() throws Exception {
    Assume.assumeTrue("Runs on JDK8", JDKUtils.jdk == JDKUtils.JDK.JDK8 || JDKUtils.jdk == JDKUtils.JDK.JDK9);
    ToolModel<CeylonCompileTool> model = pluginLoader.loadToolModel("compile");
    Assert.assertNotNull(model);
    CeylonCompileTool tool = pluginFactory.bindArguments(model, getMainTool(), toolOptions("--src=test/src", "--target=8", "org.eclipse.ceylon.tools.test.java8"));
    tool.run();
}
Also used : CeylonCompileTool(org.eclipse.ceylon.compiler.CeylonCompileTool) Test(org.junit.Test)

Example 23 with CeylonCompileTool

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

the class CompilerToolTests method testBug1623.

@Test
public void testBug1623() throws Exception {
    ToolModel<CeylonCompileTool> model = pluginLoader.loadToolModel("compile");
    Assert.assertNotNull(model);
    try {
        CeylonCompileTool tool = pluginFactory.bindArguments(model, getMainTool(), toolOptions("--src=test/src/org/eclipse/ceylon/tools/test/empty"));
        Assert.fail("Tool should have thrown an exception");
    } catch (NonFatalToolMessage e) {
        Assert.assertEquals("No modules or source files to compile", e.getMessage());
    }
}
Also used : CeylonCompileTool(org.eclipse.ceylon.compiler.CeylonCompileTool) NonFatalToolMessage(org.eclipse.ceylon.common.tool.NonFatalToolMessage) Test(org.junit.Test)

Example 24 with CeylonCompileTool

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

the class CompilerToolTests method testCompileVerbose.

@Test
public void testCompileVerbose() throws Exception {
    ToolModel<CeylonCompileTool> model = pluginLoader.loadToolModel("compile");
    Assert.assertNotNull(model);
    CeylonCompileTool tool = pluginFactory.bindArguments(model, getMainTool(), toolOptions("--verbose", "--src=test/src", "org.eclipse.ceylon.tools.test.ceylon"));
    tool.run();
}
Also used : CeylonCompileTool(org.eclipse.ceylon.compiler.CeylonCompileTool) Test(org.junit.Test)

Example 25 with CeylonCompileTool

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

the class CompilerToolTests method testCompileNoSuchEncoding.

@Test
public void testCompileNoSuchEncoding() throws Exception {
    ToolModel<CeylonCompileTool> model = pluginLoader.loadToolModel("compile");
    Assert.assertNotNull(model);
    try {
        CeylonCompileTool tool = pluginFactory.bindArguments(model, getMainTool(), toolOptions("--src=test/src", "--encoding=foo", "org.eclipse.ceylon.tools.test.ceylon"));
        Assert.fail();
    } catch (OptionArgumentException e) {
        Assert.assertEquals("Unsupported encoding: foo", e.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