kotlin-test: extract from JS library, convert to multiplatform
This commit is contained in:
@@ -256,7 +256,7 @@ abstract class BasicBoxTest(
|
||||
|
||||
configuration.put(CommonConfigurationKeys.DISABLE_INLINE, module.inliningDisabled)
|
||||
|
||||
configuration.put(JSConfigurationKeys.LIBRARY_FILES, LibrarySourcesConfig.JS_STDLIB + dependencies)
|
||||
configuration.put(JSConfigurationKeys.LIBRARY_FILES, LibrarySourcesConfig.JS_STDLIB + LibrarySourcesConfig.JS_KOTLIN_TEST + dependencies)
|
||||
|
||||
configuration.put(CommonConfigurationKeys.MODULE_NAME, module.name.removeSuffix(OLD_MODULE_SUFFIX))
|
||||
configuration.put(JSConfigurationKeys.MODULE_KIND, module.moduleKind)
|
||||
|
||||
@@ -65,6 +65,7 @@ import java.util.Map;
|
||||
import static org.jetbrains.kotlin.js.test.rhino.RhinoUtils.runRhinoTest;
|
||||
import static org.jetbrains.kotlin.js.test.utils.JsTestUtils.convertFileNameToDotJsFile;
|
||||
import static org.jetbrains.kotlin.test.InTextDirectivesUtils.isDirectiveDefined;
|
||||
import static org.jetbrains.kotlin.utils.PathUtil.getKotlinPathsForDistDirectory;
|
||||
|
||||
public abstract class BasicTest extends KotlinTestWithEnvironment {
|
||||
// predictable order of ecma version in tests
|
||||
@@ -319,6 +320,8 @@ public abstract class BasicTest extends KotlinTestWithEnvironment {
|
||||
if (libraries != null) {
|
||||
librariesWithStdlib.addAll(libraries);
|
||||
}
|
||||
librariesWithStdlib.add(getKotlinPathsForDistDirectory().getJsKotlinTestJarPath().getAbsolutePath());
|
||||
|
||||
configuration.put(JSConfigurationKeys.LIBRARY_FILES, librariesWithStdlib);
|
||||
|
||||
configuration.put(CommonConfigurationKeys.MODULE_NAME, moduleName);
|
||||
|
||||
@@ -153,6 +153,8 @@ public final class RhinoUtils {
|
||||
// System.out.print(problems);
|
||||
//}
|
||||
}
|
||||
|
||||
finishScope(scope);
|
||||
checker.runChecks(context, scope);
|
||||
}
|
||||
finally {
|
||||
@@ -162,7 +164,16 @@ public final class RhinoUtils {
|
||||
|
||||
@NotNull
|
||||
private static Scriptable getScope(@NotNull EcmaVersion version, @NotNull Context context, @NotNull List<String> jsLibraries) {
|
||||
return context.newObject(getParentScope(version, context, jsLibraries));
|
||||
Scriptable parentScope = getParentScope(version, context, jsLibraries);
|
||||
Scriptable scope = context.newObject(parentScope);
|
||||
|
||||
scope.put("kotlin-test", scope, parentScope.get("kotlin-test", parentScope));
|
||||
|
||||
return scope;
|
||||
}
|
||||
|
||||
private static void finishScope(@NotNull Scriptable scope) {
|
||||
scope.delete("kotlin-test");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -180,6 +191,8 @@ public final class RhinoUtils {
|
||||
ScriptableObject scope = context.initStandardObjects();
|
||||
try {
|
||||
runFileWithRhino(DIST_DIR_JS_PATH + "kotlin.js", context, scope);
|
||||
runFileWithRhino(DIST_DIR_JS_PATH + "../classes/kotlin-test-js/kotlin-test.js", context, scope);
|
||||
|
||||
//runFileWithRhino(pathToTestFilesRoot() + "jshint.js", context, scope);
|
||||
for (String jsLibrary : jsLibraries) {
|
||||
runFileWithRhino(jsLibrary, context, scope);
|
||||
|
||||
Reference in New Issue
Block a user