use of org.eclipse.n4js.cli.helper.CliCompileResult in project n4js by eclipse.
the class N4jscCleanTest method testCompileThenClean.
/**
* Basic compile test.
*/
@Test
public void testCompileThenClean() {
CliCompileResult compileResult = n4jsc(COMPILE(workspace), VALIDATION_ERRORS);
assertEquals(compileResult.toString(), 4, compileResult.getTranspiledFilesCount());
CliCompileResult cleanResult = n4jsc(CLEAN(workspace));
assertEquals(cleanResult.toString(), 8, cleanResult.getDeletedFilesCount());
}
use of org.eclipse.n4js.cli.helper.CliCompileResult in project n4js by eclipse.
the class N4jscTestCatalogIgnoresTestsInNodeModulesTest method testCompileAndAssertTestCatalog.
/**
* Compile and check if test catalog exists.
*/
@Test
public void testCompileAndAssertTestCatalog() throws Exception {
File testCatalog = new File(projectRoot, N4JSGlobals.TEST_CATALOG);
CliCompileResult cliResult = n4jsc(COMPILE(workspace), VALIDATION_ERRORS);
assertEquals(cliResult.toString(), 1, cliResult.getTranspiledFilesCount());
assertFalse("Superfluous test catalog in P1", testCatalog.isFile());
}
use of org.eclipse.n4js.cli.helper.CliCompileResult in project n4js by eclipse.
the class AT_IDEBUG_542_missing_dep_to_project_under_testTest method testCompileOfExtendedIterator_from_RuntimeLibrary.
/**
* The Problem was, that nothing was compiled.
*/
@Test
public void testCompileOfExtendedIterator_from_RuntimeLibrary() {
File proot = new File(workspace, PACKAGES);
N4jscOptions options = COMPILE(proot);
CliCompileResult cliResult = n4jsc(options, VALIDATION_ERRORS);
// Make sure, we get here and have exactly two files compiled:
assertEquals(cliResult.toString(), 0, cliResult.getTranspiledFilesCount(proot.toPath().resolve("APIx")));
assertEquals(cliResult.toString(), 2, cliResult.getTranspiledFilesCount(proot.toPath().resolve("APIx-test")));
}
use of org.eclipse.n4js.cli.helper.CliCompileResult in project n4js by eclipse.
the class AT_IDEBUG_654_MissingPolyfillImportsTest method compileCheckPolyfillImports_ExpectExist.
/**
*/
@Test
public void compileCheckPolyfillImports_ExpectExist() {
Path projectDir = workspace.toPath().resolve(WS_IDEBUG_654_2);
Path fileToRun = projectDir.resolve("src-gen/Main.js");
N4jscOptions options = COMPILE(workspace);
CliCompileResult cliResult = n4jsc(options, VALIDATION_ERRORS);
assertEquals(cliResult.toString(), 5, cliResult.getTranspiledFilesCount());
ProcessResult nodejsResult = nodejsRun(projectDir, fileToRun);
assertEquals(nodejsResult.toString(), "functionFromModuleA\n" + "variableFromModuleB\n" + "variableFromModuleC\n" + "variableFromModuleC", nodejsResult.getStdOut());
}
use of org.eclipse.n4js.cli.helper.CliCompileResult in project n4js by eclipse.
the class N4jscBasicTest method testBuildDependentFilesIfFileReadded.
/**
* Test a second run of the compiler after a file was added to fix compile problems
*/
@Test
public void testBuildDependentFilesIfFileReadded() throws Exception {
N4jscTestOptions compileOptions = COMPILE(DONT_CLEAN, workspace);
CliCompileResult firstRun = n4jsc(compileOptions, SUCCESS);
assertEquals(firstRun.toString(), 20, firstRun.getTranspiledFilesCount());
Path fileCn4js = proot.toPath().resolve("P1/src/c/C.n4js");
byte[] bytesC = Files.readAllBytes(fileCn4js);
Files.delete(fileCn4js);
n4jsc(compileOptions, VALIDATION_ERRORS);
// Y.n4js depends on C.n4js
File fileCjs = proot.toPath().resolve("P1/src-gen/c/C.js").toFile();
assertFalse(fileCjs.exists());
File fileYjs = proot.toPath().resolve("P1/src-gen/y/Y.js").toFile();
assertFalse(fileYjs.exists());
Files.write(fileCn4js, bytesC);
CliCompileResult thirdRun = n4jsc(compileOptions, SUCCESS);
assertTrue(fileCjs.exists());
assertTrue(fileYjs.exists());
assertOutputEqual(firstRun, thirdRun);
}
Aggregations