Search in sources :

Example 26 with ProcessResult

use of org.eclipse.n4js.cli.helper.ProcessResult in project n4js by eclipse.

the class IncompleteApiImplementationTest method testInternal_impl_Subclass_UsingDirectImplementation.

/**
 */
@Test
public void testInternal_impl_Subclass_UsingDirectImplementation() {
    String expectedString = "Loaded Implementation one.x.impl::p.IF.n4js" + "\n" + "Loaded Implementation one.x.impl::p.IFuser.n4js" + "\n" + "OK: holds not undefined";
    String fileToRunName = fileToExecute_routing("Exec_AT_IDE-1510_Internal_impl_Subclass_UsingDirectImplementation.js");
    ProcessResult nodejsResult = nodejsRun(workspace.toPath(), Path.of(fileToRunName));
    assertEquals(nodejsResult.toString(), expectedString, nodejsResult.getStdOut());
}
Also used : ProcessResult(org.eclipse.n4js.cli.helper.ProcessResult) Test(org.junit.Test) AbstractCliCompileTest(org.eclipse.n4js.cli.helper.AbstractCliCompileTest)

Example 27 with ProcessResult

use of org.eclipse.n4js.cli.helper.ProcessResult in project n4js by eclipse.

the class IncompleteApiImplementationTest method testEnums_Literal_in_existing_Enum.

// ++ ++ ++++++++ + + ++++ +++ + ++ +
// Enums
// ++ ++ ++++++++ + + ++++ +++ + ++ +
/**
 */
@Test
public void testEnums_Literal_in_existing_Enum() {
    String expectedString = "Loaded Implementation one.x.impl::p.A.n4js" + "\n" + "OK: holds not undefined" + "\n" + "OK: holds not undefined" + "\n" + "OK: holds not undefined";
    String fileToRunName = fileToExecute_direct("Exec_AT_IDE_1510_Enums_Literal_in_existing_Enum.js");
    ProcessResult nodejsResult = nodejsRun(workspace.toPath(), Path.of(fileToRunName));
    assertEquals(nodejsResult.toString(), expectedString, nodejsResult.getStdOut());
}
Also used : ProcessResult(org.eclipse.n4js.cli.helper.ProcessResult) Test(org.junit.Test) AbstractCliCompileTest(org.eclipse.n4js.cli.helper.AbstractCliCompileTest)

Example 28 with ProcessResult

use of org.eclipse.n4js.cli.helper.ProcessResult in project n4js by eclipse.

the class NodeVersionTest method testNodeVersion.

/**
 */
@Test
public void testNodeVersion() {
    Path cwd = new File("").toPath().toAbsolutePath();
    ProcessResult result = new CliTools().nodejsRun(cwd, Path.of("-v"));
    Assert.assertEquals("bad exit code", 0, result.getExitCode());
    String versionStr = result.getStdOut().trim();
    if (!N4JSGlobals.isCompatibleNodeVersion(versionStr)) {
        Assert.fail("tests are running with node version " + versionStr + " but this version is not compatible to version v" + N4JSGlobals.NODE_VERSION + " defined in " + N4JSGlobals.class.getSimpleName());
    }
}
Also used : Path(java.nio.file.Path) ProcessResult(org.eclipse.n4js.cli.helper.ProcessResult) CliTools(org.eclipse.n4js.cli.helper.CliTools) File(java.io.File) Test(org.junit.Test)

Example 29 with ProcessResult

use of org.eclipse.n4js.cli.helper.ProcessResult 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());
}
Also used : Path(java.nio.file.Path) CliCompileResult(org.eclipse.n4js.cli.helper.CliCompileResult) N4jscOptions(org.eclipse.n4js.cli.N4jscOptions) ProcessResult(org.eclipse.n4js.cli.helper.ProcessResult) Test(org.junit.Test) AbstractCliCompileTest(org.eclipse.n4js.cli.helper.AbstractCliCompileTest)

Example 30 with ProcessResult

use of org.eclipse.n4js.cli.helper.ProcessResult in project n4js by eclipse.

the class N4jscBasicTest method testCompileP1_And_Run_A_WithNodeRunner.

/**
 * Basic compile and run test.
 */
@Test
public void testCompileP1_And_Run_A_WithNodeRunner() throws Exception {
    CliCompileResult cliResult = n4jsc(COMPILE(workspace), SUCCESS);
    assertEquals(cliResult.toString(), 20, cliResult.getTranspiledFilesCount());
    Path fileA = proot.toPath().resolve("P1/src-gen/A.js");
    ProcessResult nodejsResult = nodejsRun(workspace.toPath(), fileA);
    assertEquals(nodejsResult.toString(), "A", nodejsResult.getStdOut());
}
Also used : Path(java.nio.file.Path) CliCompileResult(org.eclipse.n4js.cli.helper.CliCompileResult) ProcessResult(org.eclipse.n4js.cli.helper.ProcessResult) Test(org.junit.Test) AbstractCliCompileTest(org.eclipse.n4js.cli.helper.AbstractCliCompileTest)

Aggregations

ProcessResult (org.eclipse.n4js.cli.helper.ProcessResult)64 Test (org.junit.Test)59 AbstractCliCompileTest (org.eclipse.n4js.cli.helper.AbstractCliCompileTest)55 Path (java.nio.file.Path)13 CliCompileResult (org.eclipse.n4js.cli.helper.CliCompileResult)12 Ignore (org.junit.Ignore)9 CliTools (org.eclipse.n4js.cli.helper.CliTools)5 N4jscOptions (org.eclipse.n4js.cli.N4jscOptions)4 N4jscTestOptions (org.eclipse.n4js.cli.N4jscTestOptions)4 File (java.io.File)3 AbstractCliJarTest (org.eclipse.n4js.cli.helper.AbstractCliJarTest)2 ArrayList (java.util.ArrayList)1 CliException (org.eclipse.n4js.cli.helper.CliTools.CliException)1 Project (org.eclipse.n4js.tests.codegen.Project)1 FileURI (org.eclipse.n4js.workspace.locations.FileURI)1 Xpect (org.eclipse.xpect.runner.Xpect)1