Search in sources :

Example 11 with OptionArgumentException

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

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

Example 12 with OptionArgumentException

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

the class CompilerToolTests method testBug1179.

@Test
public void testBug1179() throws Exception {
    ToolModel<CeylonCompileTool> model = pluginLoader.loadToolModel("compile");
    Assert.assertNotNull(model);
    try {
        CeylonCompileTool tool = pluginFactory.bindArguments(model, getMainTool(), options("--src=test/src", "3"));
        Assert.fail("Tool should have thrown an exception");
    } catch (OptionArgumentException x) {
        Assert.assertEquals("Invalid module name or source file: 3\n" + "Module names should not contain any version part.\n" + "Source file names should be given relative to the current directory.", x.getMessage());
    }
}
Also used : CeylonCompileTool(com.redhat.ceylon.compiler.CeylonCompileTool) OptionArgumentException(com.redhat.ceylon.common.tool.OptionArgumentException) Test(org.junit.Test)

Example 13 with OptionArgumentException

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

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

Example 14 with OptionArgumentException

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

the class SrcToolTests method testNoArgs.

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

Example 15 with OptionArgumentException

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

the class ImportJarToolTests method testJarOnly.

@Test
public void testJarOnly() {
    ToolModel<CeylonImportJarTool> model = pluginLoader.loadToolModel("import-jar");
    Assert.assertNotNull(model);
    try {
        CeylonImportJarTool tool = pluginFactory.bindArguments(model, getMainTool(), options("my.jar"));
        Assert.fail();
    } catch (OptionArgumentException e) {
        Assert.assertEquals("Invalid value 'my.jar' 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)

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