Search in sources :

Example 1 with OptionArgumentException

use of com.redhat.ceylon.common.tool.OptionArgumentException in project ceylon-compiler by ceylon.

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(), options("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(com.redhat.ceylon.common.tool.OptionArgumentException) CeylonImportJarTool(com.redhat.ceylon.tools.importjar.CeylonImportJarTool) Test(org.junit.Test)

Example 2 with OptionArgumentException

use of com.redhat.ceylon.common.tool.OptionArgumentException in project ceylon-compiler by ceylon.

the class ImportJarToolTests method testNoArgs.

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

Example 3 with OptionArgumentException

use of com.redhat.ceylon.common.tool.OptionArgumentException in project ceylon-compiler by ceylon.

the class CompilerToolTests method testCompileNoSuchModule.

@Test
public void testCompileNoSuchModule() 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.nosuchmodule"));
        Assert.fail();
    } catch (OptionArgumentException e) {
        Assert.assertEquals("Module com.redhat.ceylon.tools.test.nosuchmodule not found in source directories: test" + File.separator + "src", e.getMessage());
    }
}
Also used : CeylonCompileTool(com.redhat.ceylon.compiler.CeylonCompileTool) OptionArgumentException(com.redhat.ceylon.common.tool.OptionArgumentException) Test(org.junit.Test)

Example 4 with OptionArgumentException

use of com.redhat.ceylon.common.tool.OptionArgumentException in project ceylon-compiler by ceylon.

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(com.redhat.ceylon.common.tool.OptionArgumentException) CeylonInfoTool(com.redhat.ceylon.tools.info.CeylonInfoTool) Test(org.junit.Test)

Example 5 with OptionArgumentException

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

Aggregations

OptionArgumentException (com.redhat.ceylon.common.tool.OptionArgumentException)15 Test (org.junit.Test)15 CeylonCompileTool (com.redhat.ceylon.compiler.CeylonCompileTool)8 CeylonImportJarTool (com.redhat.ceylon.tools.importjar.CeylonImportJarTool)3 CeylonHelpTool (com.redhat.ceylon.common.tools.help.CeylonHelpTool)1 CeylonClasspathTool (com.redhat.ceylon.tools.classpath.CeylonClasspathTool)1 CeylonInfoTool (com.redhat.ceylon.tools.info.CeylonInfoTool)1 CeylonSrcTool (com.redhat.ceylon.tools.src.CeylonSrcTool)1