Search in sources :

Example 11 with ToolUsageError

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

the class CompilerToolTests method testDefaultModuleNoFiles.

@Test
public void testDefaultModuleNoFiles() 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", "default"));
        tool.run();
        Assert.fail("Tool should have thrown an exception");
    } catch (ToolUsageError e) {
        Assert.assertEquals("Module default does not contain any sources or resources", e.getMessage());
    }
}
Also used : CeylonCompileTool(com.redhat.ceylon.compiler.CeylonCompileTool) ToolUsageError(com.redhat.ceylon.common.tool.ToolUsageError) Test(org.junit.Test)

Example 12 with ToolUsageError

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

the class ImportJarToolTests method testBug1630.

@Test
public void testBug1630() throws Exception {
    FileUtil.delete(destFile("importtest"));
    ToolModel<CeylonImportJarTool> model = pluginLoader.loadToolModel("import-jar");
    Assert.assertNotNull(model);
    try {
        CeylonImportJarTool tool = pluginFactory.bindArguments(model, getMainTool(), options("--dry-run", "--descriptor", "test/src/com/redhat/ceylon/tools/test/test-descriptor.properties", "importtest/1.0", "test/src/com/redhat/ceylon/tools/test/test2.jar"));
        tool.run();
        Assert.fail();
    } catch (ToolUsageError e) {
        Assert.assertEquals("Problems were found, aborting.", e.getMessage());
    }
}
Also used : CeylonImportJarTool(com.redhat.ceylon.tools.importjar.CeylonImportJarTool) ToolUsageError(com.redhat.ceylon.common.tool.ToolUsageError) Test(org.junit.Test)

Aggregations

ToolUsageError (com.redhat.ceylon.common.tool.ToolUsageError)12 Test (org.junit.Test)6 File (java.io.File)4 CeylonCompileTool (com.redhat.ceylon.compiler.CeylonCompileTool)2 CeylonClasspathTool (com.redhat.ceylon.tools.classpath.CeylonClasspathTool)2 CeylonImportJarTool (com.redhat.ceylon.tools.importjar.CeylonImportJarTool)2 Map (java.util.Map)2 LegacyImporter (com.redhat.ceylon.cmr.ceylon.LegacyImporter)1 DefaultToolOptions (com.redhat.ceylon.common.config.DefaultToolOptions)1 Main (com.redhat.ceylon.compiler.java.launcher.Main)1 ArtifactResult (com.redhat.ceylon.model.cmr.ArtifactResult)1 RepositoryException (com.redhat.ceylon.model.cmr.RepositoryException)1 JavacOption (com.sun.tools.javac.main.JavacOption)1 RecognizedOptions (com.sun.tools.javac.main.RecognizedOptions)1 Context (com.sun.tools.javac.util.Context)1 Options (com.sun.tools.javac.util.Options)1 IOException (java.io.IOException)1 URI (java.net.URI)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1