Search in sources :

Example 1 with SuccessExitStatus

use of org.eclipse.n4js.hlc.base.SuccessExitStatus in project n4js by eclipse.

the class N4jscBasicTest method testMainHelpDebug.

/**
 * Test debug output after help.
 */
@Test
public void testMainHelpDebug() throws ExitCodeException {
    String[] args = { "--help", "--debug" };
    SuccessExitStatus status = new N4jscBase().doMain(args);
    assertEquals("Should have printed help and exited with success.", SuccessExitStatus.INSTANCE.code, status.code);
}
Also used : SuccessExitStatus(org.eclipse.n4js.hlc.base.SuccessExitStatus) N4jscBase(org.eclipse.n4js.hlc.base.N4jscBase) Test(org.junit.Test)

Example 2 with SuccessExitStatus

use of org.eclipse.n4js.hlc.base.SuccessExitStatus in project n4js by eclipse.

the class N4jscDependentProjectDependenciesTest method testSuccessfulCompilationWithInterdependentProjects.

/**
 * Test failure when compiling without target platform file.
 *
 * @throws ExitCodeException
 *             propagated from compiler in case of issues
 */
@Test
public void testSuccessfulCompilationWithInterdependentProjects() throws ExitCodeException {
    final String wsRoot = workspace.getAbsolutePath().toString();
    final String[] args = { "--systemLoader", COMMON_JS.getId(), "--installMissingDependencies", "--targetPlatformInstallLocation", getTargetPlatformInstallLocation().getAbsolutePath(), "--verbose", "--projectlocations", wsRoot, "--buildType", BuildType.allprojects.toString() };
    SuccessExitStatus status = new N4jscBase().doMain(args);
    assertEquals("Should exit with success", SuccessExitStatus.INSTANCE.code, status.code);
    assertTrue("install location was not created", getTargetPlatformInstallLocation().exists());
}
Also used : SuccessExitStatus(org.eclipse.n4js.hlc.base.SuccessExitStatus) N4jscBase(org.eclipse.n4js.hlc.base.N4jscBase) Test(org.junit.Test)

Example 3 with SuccessExitStatus

use of org.eclipse.n4js.hlc.base.SuccessExitStatus in project n4js by eclipse.

the class TargetPlatformConfigurationsTest method testCompileWithInstallPlusCompileSkipInstall.

/**
 * Test compiling with external libraries installation, then invoke compilation without installing. We expect second
 * invocation to re-use installed external libraries in first invocation.
 *
 * @throws ExitCodeException
 *             propagated from compiler in case of issues
 */
@Test
public void testCompileWithInstallPlusCompileSkipInstall() throws ExitCodeException {
    final String wsRoot = workspace.getAbsolutePath().toString();
    final String[] argsInstall = { "--installMissingDependencies", "--targetPlatformInstallLocation", getTargetPlatformInstallLocation().getAbsolutePath(), "--verbose", "--projectlocations", wsRoot, "--buildType", BuildType.allprojects.toString() };
    SuccessExitStatus statusInstall = new N4jscBase().doMain(argsInstall);
    assertEquals("Should exit with success", SuccessExitStatus.INSTANCE.code, statusInstall.code);
    assertTrue("install location was not created", getTargetPlatformInstallLocation().exists());
    final String[] argsSkipInstall = { // "--installMissingDependencies",
    "--targetPlatformInstallLocation", getTargetPlatformInstallLocation().getAbsolutePath(), "--verbose", "--projectlocations", wsRoot, "--buildType", BuildType.allprojects.toString() };
    SuccessExitStatus statusSkipInstall = new N4jscBase().doMain(argsSkipInstall);
    assertEquals("Should exit with success", SuccessExitStatus.INSTANCE.code, statusSkipInstall.code);
    assertTrue("install location still exists", getTargetPlatformInstallLocation().exists());
}
Also used : SuccessExitStatus(org.eclipse.n4js.hlc.base.SuccessExitStatus) N4jscBase(org.eclipse.n4js.hlc.base.N4jscBase) Test(org.junit.Test)

Example 4 with SuccessExitStatus

use of org.eclipse.n4js.hlc.base.SuccessExitStatus in project n4js by eclipse.

the class TargetPlatformConfigurationsTest method testCompileCleanInstallLocation.

/**
 * Test cleaning install location.
 *
 * @throws ExitCodeException
 *             propagated from compiler in case of issues
 */
@Test
public void testCompileCleanInstallLocation() throws IOException, ExitCodeException {
    final String wsRoot = workspace.getAbsolutePath().toString();
    // force creating install location
    File testFile = new File(getTargetPlatformInstallLocation(), "tst.txt");
    testFile.createNewFile();
    assertTrue("setup error, test file should exist yet at " + testFile.getAbsolutePath(), testFile.exists());
    final String[] args = { "--clean", "--targetPlatformInstallLocation", getTargetPlatformInstallLocation().getAbsolutePath(), "--verbose", "--projectlocations", wsRoot, "--buildType", BuildType.allprojects.toString() };
    SuccessExitStatus status = new N4jscBase().doMain(args);
    assertEquals("Should exit with success", SuccessExitStatus.INSTANCE.code, status.code);
    assertFalse("install location was not cleaned, test file exists at " + testFile.getAbsolutePath(), testFile.exists());
}
Also used : SuccessExitStatus(org.eclipse.n4js.hlc.base.SuccessExitStatus) File(java.io.File) N4jscBase(org.eclipse.n4js.hlc.base.N4jscBase) Test(org.junit.Test)

Example 5 with SuccessExitStatus

use of org.eclipse.n4js.hlc.base.SuccessExitStatus in project n4js by eclipse.

the class TargetPlatformConfigurationsTest method testCompileCreatesInstallLocation.

/**
 * Test creating install location.
 *
 * @throws ExitCodeException
 *             propagated from compiler in case of issues
 */
@Test
public void testCompileCreatesInstallLocation() throws IOException, ExitCodeException {
    final String wsRoot = workspace.getAbsolutePath().toString();
    // force creating install location
    FileDeleter.delete(getTargetPlatformInstallLocation());
    final String[] args = { "--installMissingDependencies", "--targetPlatformInstallLocation", getTargetPlatformInstallLocation().getAbsolutePath(), "--verbose", "--projectlocations", wsRoot, "--buildType", BuildType.allprojects.toString() };
    SuccessExitStatus status = new N4jscBase().doMain(args);
    assertEquals("Should exit with success", SuccessExitStatus.INSTANCE.code, status.code);
    assertTrue("install location was not created", getTargetPlatformInstallLocation().exists());
}
Also used : SuccessExitStatus(org.eclipse.n4js.hlc.base.SuccessExitStatus) N4jscBase(org.eclipse.n4js.hlc.base.N4jscBase) Test(org.junit.Test)

Aggregations

N4jscBase (org.eclipse.n4js.hlc.base.N4jscBase)9 SuccessExitStatus (org.eclipse.n4js.hlc.base.SuccessExitStatus)9 Test (org.junit.Test)9 File (java.io.File)1