JS backend: remove ECMA 3, but several tests is broken.

Main reason: overload extention property:

Int.bar = 1
String.bar = 2
This commit is contained in:
Erokhin Stanislav
2013-08-28 19:53:15 +04:00
parent 248ec7a248
commit 4c57d70be9
20 changed files with 54 additions and 280 deletions
@@ -40,7 +40,7 @@ import static org.jetbrains.k2js.test.utils.JsTestUtils.convertFileNameToDotJsFi
public abstract class BasicTest extends KotlinTestWithEnvironment {
// predictable order of ecma version in tests
protected static final Iterable<EcmaVersion> DEFAULT_ECMA_VERSIONS = Lists.newArrayList(EcmaVersion.v5, EcmaVersion.v3);
protected static final Iterable<EcmaVersion> DEFAULT_ECMA_VERSIONS = Lists.newArrayList(EcmaVersion.v5);
private static final boolean DELETE_OUT = false;
private static final String TEST_FILES = "js/js.translator/testFiles/";
@@ -216,9 +216,4 @@ public abstract class BasicTest extends KotlinTestWithEnvironment {
protected String expected(@NotNull String testName) {
return getExpectedPath() + testName + ".out";
}
@NotNull
protected static List<EcmaVersion> failOnEcma5() {
return Collections.singletonList(EcmaVersion.v3);
}
}
@@ -36,7 +36,6 @@ import static org.jetbrains.jet.utils.ExceptionUtils.rethrow;
import static org.jetbrains.k2js.test.BasicTest.pathToTestFilesRoot;
public final class RhinoUtils {
private static final String KOTLIN_JS_LIB_ECMA_3 = pathToTestFilesRoot() + "kotlin_lib_ecma3.js";
private static final String KOTLIN_JS_LIB_ECMA_5 = pathToTestFilesRoot() + "kotlin_lib_ecma5.js";
private static final Set<String> IGNORED_JSHINT_WARNINGS = Sets.newHashSet();
@@ -212,7 +211,8 @@ public final class RhinoUtils {
@NotNull
public static String getKotlinLibFile(@NotNull EcmaVersion ecmaVersion) {
return ecmaVersion == EcmaVersion.v5 ? KOTLIN_JS_LIB_ECMA_5 : KOTLIN_JS_LIB_ECMA_3;
assert ecmaVersion == EcmaVersion.v5 : "Ecma 3 is deprecate";
return KOTLIN_JS_LIB_ECMA_5;
}
static void flushSystemOut(@NotNull Context context, @NotNull Scriptable scope) {
@@ -73,7 +73,7 @@ public abstract class JsUnitTestBase extends MultipleFilesTranslationTest {
}
public void runTestFile(@NotNull String pathToTestFile) throws Exception {
Iterable<EcmaVersion> versions = failOnEcma5();
Iterable<EcmaVersion> versions = DEFAULT_ECMA_VERSIONS;
String testName = pathToTestFile.substring(pathToTestFile.lastIndexOf("/"));
generateJavaScriptFiles(Lists.newArrayList(pathToTestFile), testName, MainCallParameters.noCall(), versions,
TestConfigWithUnitTests.FACTORY);
@@ -64,7 +64,7 @@ public final class KotlinLibTest extends SingleFileTranslationTest {
private void runJavascriptTest(@NotNull String filename) throws Exception {
runRhinoTest(withAdditionalFiles(cases(filename), EcmaVersion.v3),
runRhinoTest(withAdditionalFiles(cases(filename), EcmaVersion.defaultVersion()),
new RhinoFunctionResultChecker("test", true));
}
@@ -60,6 +60,14 @@ public class RegressionMergeEcmaTest extends SingleFileTranslationTest {
checkFooBoxIsOk();
}
public void testOverloadFun() throws Exception {
checkFooBoxIsOk();
}
public void testOverloadExtension() throws Exception {
checkFooBoxIsOk();
}
public void testClassInitializer() throws Exception {
checkFooBoxIsOk();
}
@@ -55,10 +55,8 @@ public final class StandardClassesTest extends SingleFileTranslationTest {
// fooBoxTest();
// }
//TODO: fails on ecma 5 because of ArrayIterator declaration: ecma 5 expects hasNext to be property while it is a function
public void testArraysIterator() throws Exception {
fooBoxTest(failOnEcma5());
fooBoxTest();
}
public void testArrayFactoryMethods() throws Exception {
@@ -16,20 +16,6 @@
package org.jetbrains.k2js.test.semantics;
import closurecompiler.internal.com.google.common.collect.Maps;
import com.google.common.collect.Lists;
import org.jetbrains.k2js.config.EcmaVersion;
import org.jetbrains.k2js.test.rhino.CompositeRhinoResultsChecker;
import org.jetbrains.k2js.test.rhino.RhinoFunctionResultChecker;
import org.jetbrains.k2js.test.rhino.RhinoQUnitResultChecker;
import org.jetbrains.k2js.test.rhino.RhinoResultChecker;
import java.io.File;
import java.util.EnumSet;
import java.util.Map;
import static org.jetbrains.k2js.test.rhino.RhinoUtils.runRhinoTest;
/**
*/
public class StdLibJsArrayQUnitTest extends StdLibQUnitTestSupport {
@@ -41,8 +27,7 @@ public class StdLibJsArrayQUnitTest extends StdLibQUnitTestSupport {
// when ran in batch
public void DISABLED_testArrayQUnitTest() throws Exception {
//performStdLibTest(EcmaVersion.all(),
performStdLibTest(EnumSet.of(EcmaVersion.v3),
performStdLibTest(DEFAULT_ECMA_VERSIONS,
"libraries/stdlib/test",
"js/JsArrayTest.kt");
}
@@ -23,8 +23,6 @@ import org.jetbrains.k2js.test.rhino.CompositeRhinoResultsChecker;
import org.jetbrains.k2js.test.rhino.RhinoFunctionResultChecker;
import org.jetbrains.k2js.test.rhino.RhinoResultChecker;
import java.io.File;
import java.util.EnumSet;
import java.util.Map;
import static org.jetbrains.k2js.test.rhino.RhinoUtils.runRhinoTest;
@@ -33,8 +31,7 @@ import static org.jetbrains.k2js.test.rhino.RhinoUtils.runRhinoTest;
*/
public class StdLibJsArrayScriptTest extends StdLibTestBase {
public void testArrayScriptTest() throws Exception {
//performStdLibTest(EcmaVersion.all(),
performStdLibTest(EnumSet.of(EcmaVersion.v3),
performStdLibTest(DEFAULT_ECMA_VERSIONS,
"libraries/stdlib/test",
"js/JsArrayScript.kt");
}