JS tests: disable Rhino optimization by default.

This commit is contained in:
Zalim Bashorov
2014-10-03 20:42:48 +04:00
parent 20f20f9441
commit 25172d797e
5 changed files with 11 additions and 16 deletions
@@ -27,10 +27,7 @@ import org.mozilla.javascript.*;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Collections; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.Set;
import static org.jetbrains.jet.utils.UtilsPackage.rethrow; import static org.jetbrains.jet.utils.UtilsPackage.rethrow;
import static org.jetbrains.k2js.test.BasicTest.TEST_DATA_DIR_PATH; import static org.jetbrains.k2js.test.BasicTest.TEST_DATA_DIR_PATH;
@@ -111,12 +108,7 @@ public final class RhinoUtils {
} }
public static void runRhinoTest(@NotNull List<String> fileNames, @NotNull RhinoResultChecker checker) throws Exception { public static void runRhinoTest(@NotNull List<String> fileNames, @NotNull RhinoResultChecker checker) throws Exception {
runRhinoTest(fileNames, checker, EcmaVersion.defaultVersion()); runRhinoTest(fileNames, checker, null, EcmaVersion.defaultVersion());
}
public static void runRhinoTest(@NotNull List<String> fileNames, @NotNull RhinoResultChecker checker, @NotNull EcmaVersion ecmaVersion)
throws Exception {
runRhinoTest(fileNames, checker, null, ecmaVersion);
} }
public static void runRhinoTest(@NotNull List<String> fileNames, public static void runRhinoTest(@NotNull List<String> fileNames,
@@ -134,6 +126,7 @@ public final class RhinoUtils {
@NotNull List<String> jsLibraries) throws Exception { @NotNull List<String> jsLibraries) throws Exception {
Context context = createContext(ecmaVersion); Context context = createContext(ecmaVersion);
context.setOptimizationLevel(OPTIMIZATION_OFF);
if (variables != null) { if (variables != null) {
context.setOptimizationLevel(getOptimizationLevel(variables)); context.setOptimizationLevel(getOptimizationLevel(variables));
} }
@@ -25,7 +25,7 @@ public final class ClassInheritanceTest extends SingleFileTranslationTest {
} }
public void testInitializersOfBasicClassExecute() throws Exception { public void testInitializersOfBasicClassExecute() throws Exception {
fooBoxIsValue(3); checkFooBoxIsOk();
} }
public void testMethodOverride() throws Exception { public void testMethodOverride() throws Exception {
@@ -29,7 +29,7 @@ public final class MiscTest extends AbstractExpressionTest {
} }
public void testLocalProperty() throws Exception { public void testLocalProperty() throws Exception {
fooBoxIsValue(50); checkFooBoxIsOk();
} }
public void testIntRange() throws Exception { public void testIntRange() throws Exception {
@@ -9,6 +9,7 @@ fun f(a: Int): Int {
return y return y
} }
fun box(): Int { fun box(): String {
return f(y) val r = f(y)
return if (r == 50) "OK" else "Fail, r = $r"
} }
@@ -8,6 +8,7 @@ class B() : A() {
} }
fun box(): Int { fun box(): String {
return (B().a) val a = B().a
return if (a == 3) "OK" else "Fail, a = $a"
} }