Search in sources :

Example 1 with CeylonHelpTool

use of com.redhat.ceylon.common.tools.help.CeylonHelpTool in project ceylon-compiler by ceylon.

the class TopLevelToolTests method getHelpOutput.

private String getHelpOutput(String toolName) {
    StringWriter sw = new StringWriter();
    CeylonHelpTool helpTool = new CeylonHelpTool();
    helpTool.setToolLoader(toolLoader);
    if (toolName != null && !toolName.isEmpty()) {
        helpTool.setTool(toolLoader.loadToolModel(toolName));
    }
    helpTool.setOut(sw);
    helpTool.run();
    return sw.toString();
}
Also used : StringWriter(java.io.StringWriter) CeylonHelpTool(com.redhat.ceylon.common.tools.help.CeylonHelpTool)

Example 2 with CeylonHelpTool

use of com.redhat.ceylon.common.tools.help.CeylonHelpTool in project ceylon-compiler by ceylon.

the class HelpToolTests method testHelpDocTool.

@Test
public void testHelpDocTool() {
    ToolModel<CeylonHelpTool> model = pluginLoader.loadToolModel("help");
    Assert.assertNotNull(model);
    CeylonHelpTool tool = pluginFactory.bindArguments(model, getMainTool(), Arrays.asList("doc-tool"));
    tool.run();
}
Also used : CeylonHelpTool(com.redhat.ceylon.common.tools.help.CeylonHelpTool) Test(org.junit.Test)

Example 3 with CeylonHelpTool

use of com.redhat.ceylon.common.tools.help.CeylonHelpTool in project ceylon-compiler by ceylon.

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

Example 4 with CeylonHelpTool

use of com.redhat.ceylon.common.tools.help.CeylonHelpTool in project ceylon-compiler by ceylon.

the class HelpToolTests method testHelp.

@Test
public void testHelp() {
    ToolModel<CeylonHelpTool> model = pluginLoader.loadToolModel("help");
    Assert.assertNotNull(model);
    Assert.assertTrue(model.isPorcelain());
    CeylonHelpTool tool = pluginFactory.bindArguments(model, getMainTool(), Collections.<String>emptyList());
    tool.run();
}
Also used : CeylonHelpTool(com.redhat.ceylon.common.tools.help.CeylonHelpTool) Test(org.junit.Test)

Example 5 with CeylonHelpTool

use of com.redhat.ceylon.common.tools.help.CeylonHelpTool in project ceylon-compiler by ceylon.

the class HelpToolTests method testHelpImportJar.

@Test
public void testHelpImportJar() {
    ToolModel<CeylonHelpTool> model = pluginLoader.loadToolModel("help");
    Assert.assertNotNull(model);
    CeylonHelpTool tool = pluginFactory.bindArguments(model, getMainTool(), Arrays.asList("import-jar"));
    tool.run();
}
Also used : CeylonHelpTool(com.redhat.ceylon.common.tools.help.CeylonHelpTool) Test(org.junit.Test)

Aggregations

CeylonHelpTool (com.redhat.ceylon.common.tools.help.CeylonHelpTool)7 Test (org.junit.Test)6 OptionArgumentException (com.redhat.ceylon.common.tool.OptionArgumentException)1 StringWriter (java.io.StringWriter)1