use of org.eclipse.n4js.hlc.base.N4jscBase in project n4js by eclipse.
the class N4jscArgumentOrderTest method testDifferentArgumentOrder.
/**
* normal compile all test without flag "--keepCompiling"
*/
@Test
public void testDifferentArgumentOrder() {
String[] shuffledArgs = shuffleArgs(shuffleOrder);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
PrintStream old = System.out;
System.setOut(ps);
try {
new N4jscBase().doMain(shuffledArgs);
Reader reader = new InputStreamReader(new ByteArrayInputStream(baos.toByteArray()));
BufferedReader bufferedReader = new BufferedReader(reader);
String line = null;
String actualOrder = "";
while ((line = bufferedReader.readLine()) != null) {
if (line.contains(". Project ")) {
old.println(line);
actualOrder += line + "\n";
}
}
assertEquals(expectedOrder, actualOrder);
} catch (Exception e) {
e.printStackTrace(System.err);
fail();
} finally {
System.out.flush();
System.setOut(old);
}
}
use of org.eclipse.n4js.hlc.base.N4jscBase in project n4js by eclipse.
the class N4jscBasicTest method testCleanAllProjects.
/**
* Test that clean removes files in src-gen folder but does not compile when compiling all projects in a given root.
*/
@Test
public void testCleanAllProjects() throws ExitCodeException {
String proot = workspace.getAbsolutePath().toString();
String[] args = { "--clean", "--projectlocations", proot, "--buildType", "allprojects" };
new N4jscBase().doMain(args);
// 0 = 0 in all projects inside wsp/basic
assertEquals(0, countFilesCompiledToES(proot));
}
use of org.eclipse.n4js.hlc.base.N4jscBase in project n4js by eclipse.
the class N4jscBasicTest method testNoCleanSingleProject.
/**
* Test that clean build is not triggered when --clean/-c is not used.
*
* @throws ExitCodeException
* expected
*/
@Test
public void testNoCleanSingleProject() throws ExitCodeException {
String proot = workspace.getAbsolutePath().toString();
String project = "TestCleanPrj1";
String pathToProject = proot + "/" + project;
String[] args = { "--projectlocations", proot, "--buildType", "projects", pathToProject };
new N4jscBase().doMain(args);
// 4 = 3 in TestCleanPrj1 + 1 in TestCleanPrj2
assertEquals(4, countFilesCompiledToES(proot));
}
use of org.eclipse.n4js.hlc.base.N4jscBase in project n4js by eclipse.
the class N4jscBasicTest method testMainHelpDebug.
/**
* Test debug output after help.
*/
@Test
public void testMainHelpDebug() throws ExitCodeException {
String[] args = { "--help", "--debug" };
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 testMainArgsProjectRoot.
/**
* normal compile test
*/
@Test
public void testMainArgsProjectRoot() throws ExitCodeException {
String proot = workspace.getAbsolutePath().toString();
// absolute filename
String file1 = proot + "/" + "PSingle/src/a/A.n4js";
String[] args = { "--projectlocations", proot, file1 };
new N4jscBase().doMain(args);
}
Aggregations