use of org.eclipse.n4js.hlc.base.N4jscBase in project n4js by eclipse.
the class N4jscBasicTest method testCleanMultipleProjects.
/**
* Test that clean removes files in src-gen folder but does not compile when compiling multiple projects.
*/
@Test
public void testCleanMultipleProjects() throws ExitCodeException {
String proot = workspace.getAbsolutePath().toString();
String project1 = "TestCleanPrj1";
String project2 = "TestCleanPrj2";
String pathToProject1 = proot + "/" + project1;
String pathToProject2 = proot + "/" + project2;
String[] args = { "--clean", "--projectlocations", proot, "--buildType", "projects", pathToProject1, pathToProject2 };
new N4jscBase().doMain(args);
// 0 = 0 in TestCleanPrj1 + 0 in TestCleanPrj2
assertEquals(0, countFilesCompiledToES(proot));
}
use of org.eclipse.n4js.hlc.base.N4jscBase in project n4js by eclipse.
the class N4jscBasicTest method testCleanSingleProject.
/**
* Test that when build type is a single project, if clean flag is on, files in src-gen folder are removed but no
* files are compiled.
*/
@Test
public void testCleanSingleProject() throws ExitCodeException {
String proot = workspace.getAbsolutePath().toString();
String project = "TestCleanPrj1";
String pathToProject = proot + "/" + project;
String[] args = { "--debug", "--clean", "--projectlocations", proot, "--buildType", "projects", pathToProject };
new N4jscBase().doMain(args);
// 1 = 0 in TestCleanPrj1 + 1 in TestCleanPrj2
assertEquals(1, countFilesCompiledToES(proot));
}
use of org.eclipse.n4js.hlc.base.N4jscBase in project n4js by eclipse.
the class N4jscBasicTest method testMainArgsCompileAllKeepCompiling.
/**
* With "keep compiling" compiler does not throw compilation errors.
*/
@Test
public void testMainArgsCompileAllKeepCompiling() throws ExitCodeException {
String proot = workspace.getAbsolutePath().toString();
String[] args = { "--projectlocations", proot, "--buildType", "allprojects", "--keepCompiling" };
new N4jscBase().doMain(args);
// Assert that at most 19 files are compiled. The actual number depends on the chosen algorithm for the build
// order and on the order in which the project dependency graph is traversed. 19 is the maximum number of files
// that can be transpiled without error.
assertTrue(countFilesCompiledToES(proot) <= 19);
}
use of org.eclipse.n4js.hlc.base.N4jscBase in project n4js by eclipse.
the class N4jscBasicTest method testMainHelp.
/**
* Test successful exit, Exception is expected but with Error-Code 0
*/
@Test
public void testMainHelp() throws ExitCodeException {
String[] args = { "--help" };
SuccessExitStatus status = new N4jscBase().doMain(args);
assertEquals("Should have printed help and exited with success.", SuccessExitStatus.INSTANCE.code, status.code);
}
use of org.eclipse.n4js.hlc.base.N4jscBase in project n4js by eclipse.
the class N4jscBasicTest method testMainInvalidDataAfterHelp.
/**
* Test debug output before help. This test doesn't run a compile because of the "-help" option should end
* execution.
*/
@Test
public void testMainInvalidDataAfterHelp() throws ExitCodeException {
String[] args = { "--help", "--preferences", "xxx", "--buildType", "allprojects", "more1", "more2", "more3" };
SuccessExitStatus status = new N4jscBase().doMain(args);
assertEquals("Should have printed help and exited with success.", SuccessExitStatus.INSTANCE.code, status.code);
}
Aggregations