use of org.eclipse.n4js.hlc.base.N4jscBase in project n4js by eclipse.
the class AT_GHOLD_212_transpilecrashTest method testCompileOfExtendedIterator_from_RuntimeLibrary.
/**
* The Problem was, that nothing was compiled.
*/
@Test
public void testCompileOfExtendedIterator_from_RuntimeLibrary() throws ExitCodeException {
String proot = workspace.getAbsolutePath().toString();
String[] args = { "--projectlocations", proot, "--buildType", "allprojects", "--verbose" };
// compile
new N4jscBase().doMain(args);
// Make sure, we get here and have exactly one file compiled:
assertFilesCompiledToES(1, proot);
}
use of org.eclipse.n4js.hlc.base.N4jscBase 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() throws ExitCodeException {
String proot = workspace.getAbsolutePath().toString();
String[] args = { "--projectlocations", proot, "--buildType", "allprojects", "--verbose" };
// compile
new N4jscBase().doMain(args);
// Make sure, we get here and have exactly two files compiled:
assertFilesCompiledToES(2, proot);
}
use of org.eclipse.n4js.hlc.base.N4jscBase in project n4js by eclipse.
the class AT_IDEBUG_654_MissingPolyfillImportsTest method compileCheckPolyfillImports_ExpectExist.
/**
*/
@Test
public void compileCheckPolyfillImports_ExpectExist() throws ExitCodeException, IOException {
// pre compile
final String wsRoot = workspace.getAbsolutePath().toString();
// Compile
final String[] args_precompile = { "--projectlocations", wsRoot, "--buildType", "allprojects", "--verbose" };
new N4jscBase().doMain(args_precompile);
// run without compile
final String fileToRun = wsRoot + "/IDEBUG-654_2/src/Main.n4js";
final String[] args = { "--projectlocations", wsRoot, "--buildType", "dontcompile", "--runWith", "nodejs", "--run", fileToRun, "--verbose" };
// Run
final String out = runAndCaptureOutput(args);
N4CliHelper.assertExpectedOutput("functionFromModuleA\n" + "variableFromModuleB\n" + "variableFromModuleC\n" + "variableFromModuleC", out);
}
use of org.eclipse.n4js.hlc.base.N4jscBase in project n4js by eclipse.
the class AbstractN4jscTest method runAndCaptureOutput.
/**
* Runs N4JSC with the given arguments.
*
* Captures the output (stdout + stderr) of the executed runner and returns it as a string.
*
* This does not include the output of N4JSC itself.
*
* @param arguments
* The arguments to pass to {@link N4jscBase#doMain(String...)}
*
* @return The command output. stderr + stdout concatenated in that order.
*
* @throws ExitCodeException
* If N4JSC exists with a non-zero exist code
* @throws IOException
* If the creation of intermediate log files fails.
*/
protected static String runAndCaptureOutput(String[] arguments) throws ExitCodeException, IOException {
boolean errors = true;
boolean keepOutputForDebug = true;
File errorFile = File.createTempFile("run_err", null);
File outputFile = File.createTempFile("run_out", null);
try {
if (!keepOutputForDebug) {
errorFile.deleteOnExit();
outputFile.deleteOnExit();
} else {
System.out.println("Errors: " + errorFile + " Ouput: " + outputFile);
}
setOutputfileSystemProperties(errorFile.getAbsolutePath(), outputFile.getAbsolutePath());
new N4jscBase().doMain(arguments);
// cleanup properties.
setOutputfileSystemProperties("", "");
// read the files, concat & return string.
return N4CliHelper.readLogfile(errorFile) + N4CliHelper.readLogfile(outputFile);
} finally {
if (errors) {
if (outputFile.canRead()) {
String readLogfile = N4CliHelper.readLogfile(outputFile);
if (!Strings.isNullOrEmpty(readLogfile))
System.out.println(readLogfile);
}
if (errorFile.canRead()) {
String readLogfile = N4CliHelper.readLogfile(errorFile);
if (!Strings.isNullOrEmpty(readLogfile))
System.out.println(readLogfile);
}
}
if (outputFile.exists())
FileUtils.deleteFileOrFolder(outputFile);
if (errorFile.exists())
FileUtils.deleteFileOrFolder(errorFile);
}
}
use of org.eclipse.n4js.hlc.base.N4jscBase in project n4js by eclipse.
the class IncompleteApiImplementationTest method compileAPI_And_API_Impl.
/**
* Setup workspace with api & api-impl & compile
*/
/**
* Upfront compilation when loading this test-class.
*/
public void compileAPI_And_API_Impl() throws ExitCodeException {
proot = workspace.getAbsolutePath().toString();
project_one_api_execution = "one.api.execution";
pathTo_one_api_execution = proot + "/" + project_one_api_execution;
String[] args = { "--projectlocations", proot, "--buildType", "allprojects", "--verbose" };
new N4jscBase().doMain(args);
}
Aggregations