use of com.redhat.ceylon.compiler.CeylonCompileTool in project ceylon-compiler by ceylon.
the class CompilerToolTests method testUnknownWarning.
@Test
public void testUnknownWarning() throws Exception {
ToolModel<CeylonCompileTool> model = pluginLoader.loadToolModel("compile");
Assert.assertNotNull(model);
try {
CeylonCompileTool tool = pluginFactory.bindArguments(model, getMainTool(), options("--suppress-warning=blah"));
Assert.fail("Tool should have thrown an exception");
} catch (OptionArgumentException e) {
Assert.assertEquals("Invalid value 'blah' given for option 'suppress-warning' to command 'compile'", e.getMessage());
// We expect this, not a FatalToolError
}
}
use of com.redhat.ceylon.compiler.CeylonCompileTool in project ceylon-compiler by ceylon.
the class CompilerToolTests method testBadIntegerLiteral.
@Test
public void testBadIntegerLiteral() throws Exception {
ToolModel<CeylonCompileTool> model = pluginLoader.loadToolModel("compile");
Assert.assertNotNull(model);
CeylonCompileTool tool = pluginFactory.bindArguments(model, getMainTool(), options("--src=test/src", "com.redhat.ceylon.tools.test.badintegerliteral"));
try {
tool.run();
Assert.fail("Tool should have thrown an exception");
} catch (CompilerErrorException e) {
// We expect this, not a FatalToolError
}
}
use of com.redhat.ceylon.compiler.CeylonCompileTool 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());
}
}
use of com.redhat.ceylon.compiler.CeylonCompileTool 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());
}
}
use of com.redhat.ceylon.compiler.CeylonCompileTool in project ceylon-compiler by ceylon.
the class CompilerToolTests method testCompileCwd.
@Test
public void testCompileCwd() throws Exception {
File destDir = destFile("compilecwdtest");
FileUtil.delete(destDir);
destDir.mkdirs();
FileUtil.copyAll(new File("test/src/com/redhat/ceylon/tools/test/cwdtest"), destDir);
ToolModel<CeylonCompileTool> model = pluginLoader.loadToolModel("compile");
Assert.assertNotNull(model);
CeylonCompileTool tool = pluginFactory.bindArguments(model, getMainTool(), Arrays.asList("--cwd", destDir.getPath(), "--src=src", "--resource=res", "--out=mod", "--rep", "aether", "--overrides", "overrides.xml", // Unfortunately --cwd doesn't affect Java options
"--javac=-cp=" + getClassPathAsPath(), "cwdtest"));
tool.run();
File carFile = getModuleArchive("cwdtest", "1", (new File(destDir, "mod")).getPath());
assertTrue(carFile.exists());
JarFile car = new JarFile(carFile);
ZipEntry entry = car.getEntry("cwdtest/test.txt");
assertNotNull(entry);
car.close();
}
Aggregations