Search in sources :

Example 6 with SuccessExitStatus

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

the class N4jscBasicTest method testMainHelp.

/**
 * Test successful exit, Exception is expected but with Error-Code 0
 */
@Test
public void testMainHelp() throws ExitCodeException {
    String[] args = { "--help" };
    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 7 with SuccessExitStatus

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

the class N4jscBasicTest method testMainInvalidDataAfterHelp.

/**
 * Test debug output before help. This test doesn't run a compile because of the "-help" option should end
 * execution.
 */
@Test
public void testMainInvalidDataAfterHelp() throws ExitCodeException {
    String[] args = { "--help", "--preferences", "xxx", "--buildType", "allprojects", "more1", "more2", "more3" };
    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 8 with SuccessExitStatus

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

the class N4jscBasicTest method testMainDebugHelp.

/**
 * Test debug output before help. This test doesn't run a compile because of the "-help" option should end
 * execution.
 */
@Test
public void testMainDebugHelp() throws ExitCodeException {
    String[] args = { "--debug", "--help" };
    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 9 with SuccessExitStatus

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

the class N4jscBasicTest method testCompileP1_And_Run_A_WithNodeRunner.

/**
 * Simple test of compiling a project and running a class from that compiled code with NODEJS.
 */
@Test
public void testCompileP1_And_Run_A_WithNodeRunner() throws ExitCodeException {
    String proot = workspace.getAbsolutePath().toString();
    // Project
    String projectP1 = "P1";
    String pathToP1 = proot + "/" + projectP1;
    // absolute src filename
    String fileA = proot + "/" + projectP1 + "/src/A.n4js";
    String[] args = { "-pl", proot, "--buildType", "projects", pathToP1, "--runWith", "nodejs", "--run", fileA, "--verbose" };
    SuccessExitStatus status = new N4jscBase().doMain(args);
    assertEquals("Should exit 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)

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