Search in sources :

Example 16 with CeylonCompileTool

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

the class CompilerToolTests method testCompileNoSuchModuleDotCeylon.

@Test
public void testCompileNoSuchModuleDotCeylon() 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.nosuchmodule.ceylon"));
        Assert.fail();
    } catch (OptionArgumentException e) {
        Assert.assertEquals("file not found: org.eclipse.ceylon.tools.test.nosuchmodule.ceylon", e.getMessage());
    }
}
Also used : CeylonCompileTool(org.eclipse.ceylon.compiler.CeylonCompileTool) OptionArgumentException(org.eclipse.ceylon.common.tool.OptionArgumentException) Test(org.junit.Test)

Example 17 with CeylonCompileTool

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

the class CompilerToolTests method testCompileWithStackOverflowError.

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

Example 18 with CeylonCompileTool

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

the class CompilerToolTests method testCompileDefault.

@Test
public void testCompileDefault() 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/deflt", "default"));
    tool.run();
}
Also used : CeylonCompileTool(org.eclipse.ceylon.compiler.CeylonCompileTool) Test(org.junit.Test)

Example 19 with CeylonCompileTool

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

Example 20 with CeylonCompileTool

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

the class CompilerToolTests method testCompileMultiple.

@Test
public void testCompileMultiple() throws Exception {
    File carFile1 = getModuleArchive("org.eclipse.ceylon.tools.test.multiple.sub1", "1.0");
    carFile1.delete();
    File carFile2 = getModuleArchive("org.eclipse.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(), toolOptions("--src=test/src", "org.eclipse.ceylon.tools.test.multiple.*"));
    tool.run();
    assertTrue(carFile1.exists() && carFile2.exists());
}
Also used : CeylonCompileTool(org.eclipse.ceylon.compiler.CeylonCompileTool) JarFile(java.util.jar.JarFile) File(java.io.File) 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