Search in sources :

Example 6 with CeylonCompileTool

use of com.redhat.ceylon.compiler.CeylonCompileTool in project ceylon-compiler by ceylon.

the class CompilerToolTests method testCompile.

@Test
public void testCompile() 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.ceylon"));
    tool.run();
}
Also used : CeylonCompileTool(com.redhat.ceylon.compiler.CeylonCompileTool) Test(org.junit.Test)

Example 7 with CeylonCompileTool

use of com.redhat.ceylon.compiler.CeylonCompileTool in project ceylon-compiler by ceylon.

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(), options("--verbose", "--src=test/src", "com.redhat.ceylon.tools.test.ceylon"));
    tool.run();
}
Also used : CeylonCompileTool(com.redhat.ceylon.compiler.CeylonCompileTool) Test(org.junit.Test)

Example 8 with CeylonCompileTool

use of com.redhat.ceylon.compiler.CeylonCompileTool in project ceylon-compiler by ceylon.

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(), options("--src=test/src", "--encoding=foo", "com.redhat.ceylon.tools.test.ceylon"));
        Assert.fail();
    } catch (OptionArgumentException e) {
        Assert.assertEquals("Unsupported encoding: foo", e.getMessage());
    }
}
Also used : CeylonCompileTool(com.redhat.ceylon.compiler.CeylonCompileTool) OptionArgumentException(com.redhat.ceylon.common.tool.OptionArgumentException) Test(org.junit.Test)

Example 9 with CeylonCompileTool

use of com.redhat.ceylon.compiler.CeylonCompileTool in project ceylon-compiler by ceylon.

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(), options("--src=test/src/com/redhat/ceylon/tools/test/empty"));
        Assert.fail("Tool should have thrown an exception");
    } catch (ToolUsageError e) {
        Assert.assertEquals("No modules or source files to compile", e.getMessage());
    }
}
Also used : CeylonCompileTool(com.redhat.ceylon.compiler.CeylonCompileTool) ToolUsageError(com.redhat.ceylon.common.tool.ToolUsageError) Test(org.junit.Test)

Example 10 with CeylonCompileTool

use of com.redhat.ceylon.compiler.CeylonCompileTool in project ceylon-compiler by ceylon.

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(), options("--src=test/src", "com.redhat.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(com.redhat.ceylon.compiler.CeylonCompileTool) SystemErrorException(com.redhat.ceylon.compiler.SystemErrorException) Test(org.junit.Test)

Aggregations

CeylonCompileTool (com.redhat.ceylon.compiler.CeylonCompileTool)27 Test (org.junit.Test)27 OptionArgumentException (com.redhat.ceylon.common.tool.OptionArgumentException)8 CompilerErrorException (com.redhat.ceylon.compiler.CompilerErrorException)6 File (java.io.File)4 JarFile (java.util.jar.JarFile)3 ToolUsageError (com.redhat.ceylon.common.tool.ToolUsageError)2 SystemErrorException (com.redhat.ceylon.compiler.SystemErrorException)2 Path (java.nio.file.Path)1 ZipEntry (java.util.zip.ZipEntry)1