Search in sources :

Example 1 with CliCompileResult

use of org.eclipse.n4js.cli.helper.CliCompileResult 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() {
    File proot = new File(workspace, PACKAGES);
    N4jscOptions options = COMPILE(proot);
    CliCompileResult cliResult = n4jsc(options, VALIDATION_ERRORS);
    // Make sure, we get here and have exactly one file compiled:
    assertEquals(cliResult.toString(), 1, cliResult.getTranspiledFilesCount());
}
Also used : CliCompileResult(org.eclipse.n4js.cli.helper.CliCompileResult) N4jscOptions(org.eclipse.n4js.cli.N4jscOptions) File(java.io.File) AbstractCliCompileTest(org.eclipse.n4js.cli.helper.AbstractCliCompileTest) Test(org.junit.Test)

Example 2 with CliCompileResult

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

the class AT_IDEBUG_532_transpilecrashTest 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);
    // Make sure, we get here and have exactly one file compiled:
    assertEquals(cliResult.toString(), 0, cliResult.getTranspiledFilesCount(proot.toPath().resolve("APIx")));
    assertEquals(cliResult.toString(), 1, cliResult.getTranspiledFilesCount(proot.toPath().resolve("IMPLx")));
}
Also used : CliCompileResult(org.eclipse.n4js.cli.helper.CliCompileResult) N4jscOptions(org.eclipse.n4js.cli.N4jscOptions) File(java.io.File) Test(org.junit.Test) AbstractCliCompileTest(org.eclipse.n4js.cli.helper.AbstractCliCompileTest)

Example 3 with CliCompileResult

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

the class AT_IDEBUG_695_CannotSetFinalFieldInCtorForStaticPolyfillsTest method compileCheckFinalFieldCanBeSetInInheritedCtor_ExpectCanBeSet.

/**
 */
@Test
public void compileCheckFinalFieldCanBeSetInInheritedCtor_ExpectCanBeSet() {
    Path projectDir = workspace.toPath().resolve(WS_IDEBUG_695);
    Path fileToRun = projectDir.resolve("src-gen/Main.js");
    N4jscOptions options = COMPILE(workspace);
    CliCompileResult cliResult = n4jsc(options, VALIDATION_ERRORS);
    assertEquals(cliResult.toString(), 2, cliResult.getTranspiledFilesCount());
    ProcessResult nodejsResult = nodejsRun(projectDir, fileToRun);
    assertEquals(nodejsResult.toString(), "A.a == 5: 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 4 with CliCompileResult

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

the class N4JSXTest method testN4JSX.

/**
 * Compile an n4jsx workspace.
 */
@Test
public void testN4JSX() {
    CliCompileResult cliResult = n4jsc(COMPILE(workspace), VALIDATION_ERRORS);
    Collection<String> fileNames = cliResult.getTranspiledFileNames();
    String expected = "packages/P1/src-gen/bar.js, ";
    expected += "packages/P2/src-gen/foo.js, ";
    expected += "packages/P2/src-gen/bar.js, ";
    expected += "packages/P2/src-gen/bar2.js, ";
    expected += "packages/P3/src-gen/bar.js, ";
    expected += "packages/P3/src-gen/foo.js";
    assertEquals(cliResult.toString(), 6, cliResult.getTranspiledFilesCount());
    assertEquals(cliResult.toString(), expected, String.join(", ", fileNames));
}
Also used : CliCompileResult(org.eclipse.n4js.cli.helper.CliCompileResult) AbstractCliCompileTest(org.eclipse.n4js.cli.helper.AbstractCliCompileTest) Test(org.junit.Test)

Example 5 with CliCompileResult

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

the class N4jscCleanTest method testCleanCompile.

/**
 * Basic compile test.
 */
@Test
public void testCleanCompile() {
    CliCompileResult compileResult = n4jsc(COMPILE(workspace), VALIDATION_ERRORS);
    assertEquals(compileResult.toString(), 4, compileResult.getTranspiledFilesCount());
    CliCompileResult cleanResult = n4jsc(COMPILE(workspace).clean(), VALIDATION_ERRORS);
    assertEquals(cleanResult.toString(), 8, cleanResult.getDeletedFilesCount());
}
Also used : CliCompileResult(org.eclipse.n4js.cli.helper.CliCompileResult) AbstractCliCompileTest(org.eclipse.n4js.cli.helper.AbstractCliCompileTest) Test(org.junit.Test)

Aggregations

CliCompileResult (org.eclipse.n4js.cli.helper.CliCompileResult)92 Test (org.junit.Test)90 AbstractCliCompileTest (org.eclipse.n4js.cli.helper.AbstractCliCompileTest)41 N4jscTestOptions (org.eclipse.n4js.cli.N4jscTestOptions)22 File (java.io.File)20 Path (java.nio.file.Path)12 ProcessResult (org.eclipse.n4js.cli.helper.ProcessResult)12 N4jscOptions (org.eclipse.n4js.cli.N4jscOptions)8 AbstractCliJarTest (org.eclipse.n4js.cli.helper.AbstractCliJarTest)6 Gson (com.google.gson.Gson)1 JsonObject (com.google.gson.JsonObject)1 JsonPrimitive (com.google.gson.JsonPrimitive)1 FileReader (java.io.FileReader)1 IOException (java.io.IOException)1 CliTools (org.eclipse.n4js.cli.helper.CliTools)1 CliException (org.eclipse.n4js.cli.helper.CliTools.CliException)1 Ignore (org.junit.Ignore)1