Search in sources :

Example 36 with ProcessResult

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

the class N4jsLibsTest method testN4jsLibs.

/**
 */
@Test
public void testN4jsLibs() throws IOException {
    final Path n4jsRootPath = UtilN4.findN4jsRepoRootPath();
    final Path n4jsLibsRootPath = n4jsRootPath.resolve(N4JSGlobals.N4JS_LIBS_FOLDER_NAME);
    final Path testReportPath = n4jsLibsRootPath.resolve("build").resolve("report.xml");
    Files.deleteIfExists(testReportPath);
    CliTools cliTools = new CliTools();
    cliTools.setInheritIO(true);
    ProcessResult result = cliTools.yarnRun(n4jsLibsRootPath, "run", "test");
    assertEquals("non-zero exit code", 0, result.getExitCode());
    assertTrue("test report not found", Files.isRegularFile(testReportPath));
}
Also used : Path(java.nio.file.Path) ProcessResult(org.eclipse.n4js.cli.helper.ProcessResult) CliTools(org.eclipse.n4js.cli.helper.CliTools) Test(org.junit.Test)

Example 37 with ProcessResult

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

the class AT_IDEBUG_654_ExportPlainJsModulesTest method compileCheckModuleExportFromPlainJsFile_ExpectAvailable.

/**
 */
@Test
public void compileCheckModuleExportFromPlainJsFile_ExpectAvailable() {
    Path projectDir = workspace.toPath().resolve(WS_IDEBUG_654);
    Path fileToRun = projectDir.resolve("src-gen/Client.js");
    N4jscOptions options = COMPILE(workspace);
    CliCompileResult cliResult = n4jsc(options);
    assertEquals(cliResult.toString(), 2, cliResult.getTranspiledFilesCount());
    ProcessResult nodejsResult = nodejsRun(projectDir, fileToRun);
    assertEquals(nodejsResult.toString(), "foo === 36: true, bar === 'bar': true", 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 38 with ProcessResult

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

the class IncompleteApiImplementationTest method testEnums_normal_existing_EnumSB.

/**
 */
@Test
public void testEnums_normal_existing_EnumSB() {
    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_normal_existing_EnumSB.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 39 with ProcessResult

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

the class IncompleteApiImplementationTest method testfield_vs_getset_4.

/**
 */
@Test
public void testfield_vs_getset_4() {
    String expectedString = "Loaded Implementation one.x.impl::fields.F.n4js";
    String fileToRunName = fileToExecute_fields("Exec_AT_IDEBUG-505_field_vs_getset_5.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 40 with ProcessResult

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

the class IncompleteApiImplementationTest method testMissing_method_in_class.

/**
 */
@Test
public void testMissing_method_in_class() {
    String fileToRunName = fileToExecute_direct("Exec_missing_field_in_class.js");
    ProcessResult nodejsResult = nodejsRun(workspace.toPath(), Path.of(fileToRunName));
    String expectedString = "Loaded Implementation one.x.impl::p.A.n4js";
    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)

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