use of org.jetbrains.kotlin.js.config.EcmaVersion in project kotlin by JetBrains.
the class JsUnitTestBase method runTestFile.
public void runTestFile(@NotNull String pathToTestFile) throws Exception {
Iterable<EcmaVersion> versions = DEFAULT_ECMA_VERSIONS;
String testName = pathToTestFile.substring(pathToTestFile.lastIndexOf("/"));
generateJavaScriptFiles(Collections.singletonList(pathToTestFile), testName, MainCallParameters.noCall(), versions);
runRhinoTests(testName, versions, new RhinoSystemOutputChecker(""));
}
use of org.jetbrains.kotlin.js.config.EcmaVersion in project kotlin by JetBrains.
the class CompileMavenGeneratedJSLibrary method generateJavaScriptFiles.
private void generateJavaScriptFiles(@NotNull Iterable<EcmaVersion> ecmaVersions, @NotNull String sourceDir, @NotNull String... stdLibFiles) throws Exception {
List<String> files = Lists.newArrayList();
// now lets add all the files from the definitions and library
//addAllSourceFiles(files, generatedJsDefinitionsDir);
addAllSourceFiles(files, generatedJsLibraryDir);
File stdlibDir = new File(sourceDir);
assertTrue("Cannot find stdlib test source: " + stdlibDir, stdlibDir.exists());
for (String file : stdLibFiles) {
files.add(new File(stdlibDir, file).getPath());
}
// now lets try invoke the compiler
for (EcmaVersion version : ecmaVersions) {
String outputFile = getOutputFilePath(getTestName(false) + ".compiler.kt", version);
System.out.println("Compiling with version: " + version + " to: " + outputFile);
List<String> args = new ArrayList<String>(Arrays.asList("-output", outputFile, "-libraries", generatedJsDefinitionsDir, "-verbose"));
args.addAll(files);
ExitCode answer = new K2JSCompiler().exec(System.out, ArrayUtil.toStringArray(args));
assertEquals("Compile failed", ExitCode.OK, answer);
}
}
Aggregations