Search in sources :

Example 1 with N4jscOptions

use of org.eclipse.n4js.cli.N4jscOptions 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 N4jscOptions

use of org.eclipse.n4js.cli.N4jscOptions 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 N4jscOptions

use of org.eclipse.n4js.cli.N4jscOptions 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 N4jscOptions

use of org.eclipse.n4js.cli.N4jscOptions 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")));
}
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 5 with N4jscOptions

use of org.eclipse.n4js.cli.N4jscOptions 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)

Aggregations

N4jscOptions (org.eclipse.n4js.cli.N4jscOptions)9 CliCompileResult (org.eclipse.n4js.cli.helper.CliCompileResult)8 AbstractCliCompileTest (org.eclipse.n4js.cli.helper.AbstractCliCompileTest)7 Test (org.junit.Test)7 File (java.io.File)5 Path (java.nio.file.Path)5 ProcessResult (org.eclipse.n4js.cli.helper.ProcessResult)4 Objects (com.google.common.base.Objects)1 Strings (com.google.common.base.Strings)1 Predicate (java.util.function.Predicate)1 URI (org.eclipse.emf.common.util.URI)1 N4jscConsole (org.eclipse.n4js.cli.N4jscConsole)1 N4jscException (org.eclipse.n4js.cli.N4jscException)1 InitOptions (org.eclipse.n4js.cli.N4jscOptions.InitOptions)1 FileHelloWorld (org.eclipse.n4js.cli.init.InitResources.FileHelloWorld)1 FileHelloWorldTest (org.eclipse.n4js.cli.init.InitResources.FileHelloWorldTest)1 IndexFile (org.eclipse.n4js.cli.init.InitResources.IndexFile)1 PackageJsonContents (org.eclipse.n4js.cli.init.InitResources.PackageJsonContents)1 YarnPackageJsonContents (org.eclipse.n4js.cli.init.InitResources.YarnPackageJsonContents)1 WorkingDirState (org.eclipse.n4js.cli.init.N4jscInit.WorkingDirState)1