Search in sources :

Example 1 with CeylonSrcTool

use of com.redhat.ceylon.tools.src.CeylonSrcTool in project ceylon-compiler by ceylon.

the class SrcToolTests method testModuleVersion.

@Test
public void testModuleVersion() throws Exception {
    ToolModel<CeylonSrcTool> model = pluginLoader.loadToolModel("src");
    Assert.assertNotNull(model);
    CeylonSrcTool tool = pluginFactory.bindArguments(model, getMainTool(), Collections.<String>singletonList("ceylon.language/" + Versions.CEYLON_VERSION_NUMBER));
}
Also used : CeylonSrcTool(com.redhat.ceylon.tools.src.CeylonSrcTool) Test(org.junit.Test)

Example 2 with CeylonSrcTool

use of com.redhat.ceylon.tools.src.CeylonSrcTool 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 3 with CeylonSrcTool

use of com.redhat.ceylon.tools.src.CeylonSrcTool in project ceylon-compiler by ceylon.

the class SrcToolTests method testOffline.

@Test
public void testOffline() throws Exception {
    ToolModel<CeylonSrcTool> model = pluginLoader.loadToolModel("src");
    Assert.assertNotNull(model);
    CeylonSrcTool tool = pluginFactory.bindArguments(model, getMainTool(), Arrays.<String>asList("--offline", "ceylon.language"));
}
Also used : CeylonSrcTool(com.redhat.ceylon.tools.src.CeylonSrcTool) Test(org.junit.Test)

Example 4 with CeylonSrcTool

use of com.redhat.ceylon.tools.src.CeylonSrcTool in project ceylon-compiler by ceylon.

the class SrcToolTests method testUnpacking.

@Test
public void testUnpacking() throws Exception {
    compile("src_tool_test/module.ceylon", "src_tool_test/package.ceylon", "src_tool_test/foo.ceylon");
    ToolModel<CeylonSrcTool> model = pluginLoader.loadToolModel("src");
    Assert.assertNotNull(model);
    CeylonSrcTool tool = pluginFactory.bindArguments(model, getMainTool(), Arrays.<String>asList("--cacherep", getCachePath(), "--rep", getOutPath(), "--src", "build/test-source", "com.redhat.ceylon.tools.test.test_mod_source.src_tool_test/1.0.0"));
    tool.run();
    String path = "build/test-source/com/redhat/ceylon/tools/test/test_mod_source/src_tool_test";
    File dir = new File(path);
    Assert.assertTrue(dir.isDirectory());
    File moduleFile = new File(dir, "module.ceylon");
    Assert.assertTrue(moduleFile.isFile());
    File packageFile = new File(dir, "package.ceylon");
    Assert.assertTrue(packageFile.isFile());
    File fooFile = new File(dir, "foo.ceylon");
    Assert.assertTrue(fooFile.isFile());
}
Also used : CeylonSrcTool(com.redhat.ceylon.tools.src.CeylonSrcTool) File(java.io.File) Test(org.junit.Test)

Example 5 with CeylonSrcTool

use of com.redhat.ceylon.tools.src.CeylonSrcTool in project ceylon-compiler by ceylon.

the class SrcToolTests method testUnpackingCwd.

@Test
public void testUnpackingCwd() throws Exception {
    compile("src_tool_test/module.ceylon", "src_tool_test/package.ceylon", "src_tool_test/foo.ceylon");
    ToolModel<CeylonSrcTool> model = pluginLoader.loadToolModel("src");
    Assert.assertNotNull(model);
    CeylonSrcTool tool = pluginFactory.bindArguments(model, getMainTool(), Arrays.<String>asList("--cacherep", removeRoot(getCachePath()), "--rep", removeRoot(getOutPath()), "--cwd", "build", "--src", "test-source2", "com.redhat.ceylon.tools.test.test_mod_source.src_tool_test/1.0.0"));
    tool.run();
    String path = "build/test-source2/com/redhat/ceylon/tools/test/test_mod_source/src_tool_test";
    File dir = new File(path);
    Assert.assertTrue(dir.isDirectory());
    File moduleFile = new File(dir, "module.ceylon");
    Assert.assertTrue(moduleFile.isFile());
    File packageFile = new File(dir, "package.ceylon");
    Assert.assertTrue(packageFile.isFile());
    File fooFile = new File(dir, "foo.ceylon");
    Assert.assertTrue(fooFile.isFile());
}
Also used : CeylonSrcTool(com.redhat.ceylon.tools.src.CeylonSrcTool) File(java.io.File) Test(org.junit.Test)

Aggregations

CeylonSrcTool (com.redhat.ceylon.tools.src.CeylonSrcTool)6 Test (org.junit.Test)6 File (java.io.File)2 OptionArgumentException (com.redhat.ceylon.common.tool.OptionArgumentException)1