Search in sources :

Example 16 with OptionArgumentException

use of org.eclipse.ceylon.common.tool.OptionArgumentException 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)

Example 17 with OptionArgumentException

use of org.eclipse.ceylon.common.tool.OptionArgumentException in project ceylon by eclipse.

the class CompilerToolTests method testCompileModuleAndVersion.

@Test
public void testCompileModuleAndVersion() 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.ceylon/1.0"));
        Assert.fail();
    } catch (OptionArgumentException e) {
        Assert.assertEquals("Invalid module name or source file: org.eclipse.ceylon.tools.test.ceylon/1.0\n" + "Module names should not contain any version part.\n" + "Source file names should be given relative to the current directory.", e.getMessage());
    }
}
Also used : CeylonCompileTool(org.eclipse.ceylon.compiler.CeylonCompileTool) OptionArgumentException(org.eclipse.ceylon.common.tool.OptionArgumentException) Test(org.junit.Test)

Example 18 with OptionArgumentException

use of org.eclipse.ceylon.common.tool.OptionArgumentException in project ceylon by eclipse.

the class CompilerToolTests method testCompileNoSuchModuleDotJava.

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

Example 19 with OptionArgumentException

use of org.eclipse.ceylon.common.tool.OptionArgumentException in project ceylon by eclipse.

the class RunToolTestCase method testNoArgs.

@Test
public void testNoArgs() throws Exception {
    ToolModel<CeylonRunTool> model = pluginLoader.loadToolModel("run");
    Assert.assertNotNull(model);
    try {
        CeylonRunTool tool = pluginFactory.bindArguments(model, getMainTool(), Collections.<String>emptyList());
        Assert.fail();
    } catch (OptionArgumentException e) {
    // asserting this is thrown
    }
}
Also used : CeylonRunTool(ceylon.modules.bootstrap.CeylonRunTool) OptionArgumentException(org.eclipse.ceylon.common.tool.OptionArgumentException) Test(org.junit.Test) AbstractToolTest(org.eclipse.ceylon.common.tool.AbstractToolTest)

Aggregations

OptionArgumentException (org.eclipse.ceylon.common.tool.OptionArgumentException)19 Test (org.junit.Test)18 CeylonCompileTool (org.eclipse.ceylon.compiler.CeylonCompileTool)8 CeylonImportJarTool (org.eclipse.ceylon.tools.importjar.CeylonImportJarTool)3 CeylonRunTool (ceylon.modules.bootstrap.CeylonRunTool)1 AbstractToolTest (org.eclipse.ceylon.common.tool.AbstractToolTest)1 FatalToolError (org.eclipse.ceylon.common.tool.FatalToolError)1 ModelException (org.eclipse.ceylon.common.tool.ModelException)1 NoSuchToolException (org.eclipse.ceylon.common.tool.NoSuchToolException)1 ToolError (org.eclipse.ceylon.common.tool.ToolError)1 TestSubtoolTool (org.eclipse.ceylon.common.tool.example.TestSubtoolTool)1 CeylonHelpTool (org.eclipse.ceylon.common.tools.help.CeylonHelpTool)1 CeylonClasspathTool (org.eclipse.ceylon.tools.classpath.CeylonClasspathTool)1 CeylonInfoTool (org.eclipse.ceylon.tools.info.CeylonInfoTool)1 CeylonMavenExportTool (org.eclipse.ceylon.tools.maven.export.CeylonMavenExportTool)1 CeylonSrcTool (org.eclipse.ceylon.tools.src.CeylonSrcTool)1