use of org.eclipse.n4js.hlc.base.N4jscBase 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());
}
use of org.eclipse.n4js.hlc.base.N4jscBase 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());
}
use of org.eclipse.n4js.hlc.base.N4jscBase in project n4js by eclipse.
the class AT_IDEBUG_695_CannotSetFinalFieldInCtorForStaticPolyfillsTest method compileCheckFinalFieldCanBeSetInInheritedCtor_ExpectCanBeSet.
/**
*/
@Test
public void compileCheckFinalFieldCanBeSetInInheritedCtor_ExpectCanBeSet() throws ExitCodeException, IOException {
// pre compile
final String wsRoot = workspace.getAbsolutePath().toString();
// Compile
final String[] args_precompile = { "--projectlocations", wsRoot, "--buildType", "allprojects", "--verbose" };
new N4jscBase().doMain(args_precompile);
// run without compile
final String fileToRun = wsRoot + "/IDEBUG-695/src/Main.n4js";
final String[] args = { "--projectlocations", wsRoot, "--buildType", "dontcompile", "--runWith", "nodejs", "--run", fileToRun, "--verbose" };
// Run
final String out = runAndCaptureOutput(args);
N4CliHelper.assertExpectedOutput("A.a == 5: true", out);
}
use of org.eclipse.n4js.hlc.base.N4jscBase in project n4js by eclipse.
the class N4jscTestersTest method testCompileAllProjectsGenerateTestCatalog_absolutePath.
/**
* Gathers all tests from the workspace and generates a test catalog (given as absolute path).
*/
@Test
public void testCompileAllProjectsGenerateTestCatalog_absolutePath() throws ExitCodeException, FileNotFoundException, IOException {
String proot = workspace.getAbsolutePath().toString();
final File tempDir = Files.createTempDir();
tempDir.deleteOnExit();
final String[] args = { "--projectlocations", proot, "--buildType", "allprojects", "--testCatalogFile", tempDir + "/test-catalog.json", "--verbose" };
new N4jscBase().doMain(args);
final File file = new File(tempDir + "/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 testCompileAllProjectsGenerateTestCatalog_existingRelativePath.
/**
* Gathers all tests from the workspace and generates a test catalog into an existing file (given as relative path).
*/
@Test
public void testCompileAllProjectsGenerateTestCatalog_existingRelativePath() throws ExitCodeException, FileNotFoundException, IOException {
String proot = workspace.getAbsolutePath().toString();
final File existingFile = new File("test-catalog.json");
existingFile.createNewFile();
existingFile.deleteOnExit();
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);
}
Aggregations