use of org.eclipse.n4js.hlc.base.N4jscBase 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);
}
use of org.eclipse.n4js.hlc.base.N4jscBase 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);
}
use of org.eclipse.n4js.hlc.base.N4jscBase in project n4js by eclipse.
the class N4jscTestersTest method testCompileAllProjectsGenerateTestCatalog_relativePath.
/**
* Gathers all tests from the workspace and generates a test catalog (given as relative path).
*/
@Test
public void testCompileAllProjectsGenerateTestCatalog_relativePath() throws ExitCodeException, FileNotFoundException, IOException {
String proot = workspace.getAbsolutePath().toString();
final String[] args = { "--projectlocations", proot, "--buildType", "allprojects", "--testCatalogFile", "test-catalog.json", "--verbose" };
new N4jscBase().doMain(args);
final File file = new File("test-catalog.json");
file.deleteOnExit();
final String actual = new String(java.nio.file.Files.readAllBytes(Paths.get(file.toURI())));
assertEquals(EXPECTED_TEST_CATALOG, actual);
}
use of org.eclipse.n4js.hlc.base.N4jscBase in project n4js by eclipse.
the class N4jscTestersTest method testCompile_And_LaunchSingleIgnoredTestFile.
/**
* Simple test of compiling a project and execute tests from <u>a single test file</u>.
*
* @throws ExitCodeException
* in error cases ( not expected )
*/
@Test
public void testCompile_And_LaunchSingleIgnoredTestFile() throws ExitCodeException {
String proot = workspace.getAbsolutePath().toString();
// Project
String projectDemoTest = "DemoTest";
String pathToDemoTest = proot + "/" + projectDemoTest;
// absolute src filename
String fileFooTest = pathToDemoTest + "/test/BazTest.n4js";
String[] args = { "--projectlocations", proot, "--buildType", "allprojects", "--testWith", "nodejs_mangelhaft", "--test", fileFooTest, "--verbose" };
new N4jscBase().doMain(args);
// TODO add proper assertion that test was actually executed properly!!!
}
use of org.eclipse.n4js.hlc.base.N4jscBase in project n4js by eclipse.
the class N4jscTestersTest method testCompile_And_LaunchSinglePassingTestFile.
/**
* Simple test of compiling a project and execute tests from <u>a single test file</u>.
*
* @throws ExitCodeException
* in error cases ( not expected )
*/
@Test
public void testCompile_And_LaunchSinglePassingTestFile() throws ExitCodeException {
String proot = workspace.getAbsolutePath().toString();
// Project
String projectDemoTest = "DemoTest";
String pathToDemoTest = proot + "/" + projectDemoTest;
// absolute src filename
String fileFooTest = pathToDemoTest + "/test/FooTest.n4js";
String[] args = { "--projectlocations", proot, "--buildType", "allprojects", "--testWith", "nodejs_mangelhaft", "--test", fileFooTest, "--verbose" };
new N4jscBase().doMain(args);
// TODO add proper assertion that test was actually executed properly!!!
}
Aggregations