Search in sources :

Example 11 with OptionArgumentException

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

the class HelpToolTests method testHelpCompiler.

@Test
public void testHelpCompiler() {
    ToolModel<CeylonHelpTool> model = pluginLoader.loadToolModel("help");
    Assert.assertNotNull(model);
    CeylonHelpTool tool = pluginFactory.bindArguments(model, getMainTool(), Arrays.asList("compile"));
    tool.setToolLoader(pluginLoader);
    tool.run();
    try {
        pluginFactory.bindArguments(model, getMainTool(), Arrays.asList("--", "compile", "--javac="));
        Assert.fail();
    } catch (OptionArgumentException e) {
        Assert.assertEquals("Unexpected argument '--javac=' to command 'help'", e.getMessage());
    }
}
Also used : OptionArgumentException(org.eclipse.ceylon.common.tool.OptionArgumentException) CeylonHelpTool(org.eclipse.ceylon.common.tools.help.CeylonHelpTool) Test(org.junit.Test)

Example 12 with OptionArgumentException

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

the class ImportJarToolTests method testModuleOnlyJar.

@Test
public void testModuleOnlyJar() {
    ToolModel<CeylonImportJarTool> model = pluginLoader.loadToolModel("import-jar");
    Assert.assertNotNull(model);
    try {
        CeylonImportJarTool tool = pluginFactory.bindArguments(model, getMainTool(), toolOptions("test", "my.jar"));
        Assert.fail();
    } catch (OptionArgumentException e) {
        Assert.assertEquals("Invalid value 'test' given for argument 'module' to command 'import-jar'", e.getMessage());
    }
}
Also used : OptionArgumentException(org.eclipse.ceylon.common.tool.OptionArgumentException) CeylonImportJarTool(org.eclipse.ceylon.tools.importjar.CeylonImportJarTool) Test(org.junit.Test)

Example 13 with OptionArgumentException

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

the class InfoToolTests method testNoArgs.

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

Example 14 with OptionArgumentException

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

the class MavenExportToolTests method testNoArgs.

@Test
public void testNoArgs() {
    ToolModel<CeylonMavenExportTool> model = pluginLoader.loadToolModel("maven-export");
    Assert.assertNotNull(model);
    try {
        CeylonMavenExportTool tool = pluginFactory.bindArguments(model, getMainTool(), toolOptions());
        Assert.fail();
    } catch (OptionArgumentException e) {
        Assert.assertEquals("Argument 'module' to command 'maven-export' should appear at least 1 time(s)", e.getMessage());
    }
}
Also used : OptionArgumentException(org.eclipse.ceylon.common.tool.OptionArgumentException) CeylonMavenExportTool(org.eclipse.ceylon.tools.maven.export.CeylonMavenExportTool) Test(org.junit.Test)

Example 15 with OptionArgumentException

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

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