diff --git a/js/js.tests/test/org/jetbrains/k2js/test/rhino/RhinoFunctionNativeObjectResultChecker.java b/js/js.tests/test/org/jetbrains/k2js/test/rhino/RhinoFunctionNativeObjectResultChecker.java index 0cbd94aff4c..56898278323 100644 --- a/js/js.tests/test/org/jetbrains/k2js/test/rhino/RhinoFunctionNativeObjectResultChecker.java +++ b/js/js.tests/test/org/jetbrains/k2js/test/rhino/RhinoFunctionNativeObjectResultChecker.java @@ -16,6 +16,7 @@ package org.jetbrains.k2js.test.rhino; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.mozilla.javascript.Context; import org.mozilla.javascript.NativeJavaObject; @@ -25,12 +26,13 @@ import org.mozilla.javascript.NativeJavaObject; */ public class RhinoFunctionNativeObjectResultChecker extends RhinoFunctionResultChecker { - public RhinoFunctionNativeObjectResultChecker(@Nullable String packageName, String functionName, Object expectedResult) { - super(packageName, functionName, expectedResult); - } - - public RhinoFunctionNativeObjectResultChecker(String functionName, Object expectedResult) { - super(functionName, expectedResult); + public RhinoFunctionNativeObjectResultChecker( + @NotNull String moduleName, + @Nullable String packageName, + @NotNull String functionName, + @NotNull Object expectedResult + ) { + super(moduleName, packageName, functionName, expectedResult); } @Override diff --git a/js/js.tests/test/org/jetbrains/k2js/test/rhino/RhinoFunctionResultChecker.java b/js/js.tests/test/org/jetbrains/k2js/test/rhino/RhinoFunctionResultChecker.java index 227a8e7936b..2e9bd415433 100644 --- a/js/js.tests/test/org/jetbrains/k2js/test/rhino/RhinoFunctionResultChecker.java +++ b/js/js.tests/test/org/jetbrains/k2js/test/rhino/RhinoFunctionResultChecker.java @@ -16,8 +16,8 @@ package org.jetbrains.k2js.test.rhino; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.k2js.config.Config; import org.jetbrains.k2js.translate.context.Namer; import org.mozilla.javascript.Context; import org.mozilla.javascript.Scriptable; @@ -32,21 +32,13 @@ public class RhinoFunctionResultChecker implements RhinoResultChecker { private final String functionName; private final Object expectedResult; - public RhinoFunctionResultChecker(@Nullable String packageName, String functionName, Object expectedResult) { - this(Config.REWRITABLE_MODULE_NAME, packageName, functionName, expectedResult); - } - - public RhinoFunctionResultChecker(@Nullable String moduleId, @Nullable String packageName, String functionName, Object expectedResult) { + public RhinoFunctionResultChecker(@NotNull String moduleId, @Nullable String packageName, @NotNull String functionName, @NotNull Object expectedResult) { this.moduleId = moduleId; this.packageName = packageName; this.functionName = functionName; this.expectedResult = expectedResult; } - public RhinoFunctionResultChecker(String functionName, Object expectedResult) { - this(null, functionName, expectedResult); - } - @Override public void runChecks(Context context, Scriptable scope) throws Exception { Object result = evaluateFunction(context, scope); @@ -57,8 +49,6 @@ public class RhinoFunctionResultChecker implements RhinoResultChecker { protected void assertResultValid(Object result, Context context) { String ecmaVersion = context.getLanguageVersion() == Context.VERSION_1_8 ? "ecma5" : "ecma3"; assertEquals("Result of " + packageName + "." + functionName + "() is not what expected (" + ecmaVersion + ")!", expectedResult, result); - String report = packageName + "." + functionName + "() = " + Context.toString(result); - System.out.println(report); } private Object evaluateFunction(Context cx, Scriptable scope) { diff --git a/js/js.tests/test/org/jetbrains/k2js/test/rhino/RhinoQUnitResultChecker.java b/js/js.tests/test/org/jetbrains/k2js/test/rhino/RhinoQUnitResultChecker.java index 83eb4d4300f..aee7b3e50b7 100644 --- a/js/js.tests/test/org/jetbrains/k2js/test/rhino/RhinoQUnitResultChecker.java +++ b/js/js.tests/test/org/jetbrains/k2js/test/rhino/RhinoQUnitResultChecker.java @@ -16,36 +16,25 @@ package org.jetbrains.k2js.test.rhino; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.k2js.test.config.TestConfig; -import org.jetbrains.k2js.translate.context.Namer; import org.mozilla.javascript.Context; import org.mozilla.javascript.NativeArray; import org.mozilla.javascript.Scriptable; import static org.jetbrains.k2js.test.rhino.RhinoUtils.flushSystemOut; -import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; /** * Runs the QUnit test cases in headless mode (without requiring a browser) and asserts they all PASS */ public class RhinoQUnitResultChecker implements RhinoResultChecker { - - private final String moduleId; - - public RhinoQUnitResultChecker(@Nullable String moduleId) { - this.moduleId = moduleId; - } - @Override public void runChecks(Context context, Scriptable scope) throws Exception { Object result = evaluateFunction(context, scope); flushSystemOut(context, scope); - assertResultValid(result, context); + assertResultValid(result); } - protected void assertResultValid(Object result, Context context) { + protected void assertResultValid(Object result) { if (result instanceof NativeArray) { NativeArray array = (NativeArray) result; StringBuffer buffer = new StringBuffer(); diff --git a/js/js.tests/test/org/jetbrains/k2js/test/semantics/StdLibQUnitTestSupport.java b/js/js.tests/test/org/jetbrains/k2js/test/semantics/StdLibQUnitTestSupport.java index 787bc3deb0f..15503860fa2 100644 --- a/js/js.tests/test/org/jetbrains/k2js/test/semantics/StdLibQUnitTestSupport.java +++ b/js/js.tests/test/org/jetbrains/k2js/test/semantics/StdLibQUnitTestSupport.java @@ -41,8 +41,7 @@ public abstract class StdLibQUnitTestSupport extends StdLibTestBase { } protected void runQUnitTestCase(String path, EcmaVersion version, Map variables) throws Exception { - String moduleId = moduleIdFromOutputFile(path); - RhinoResultChecker checker = new RhinoQUnitResultChecker(moduleId); + RhinoResultChecker checker = new RhinoQUnitResultChecker(); runRhinoTest(Lists.newArrayList(path), checker, variables, version, Lists.newArrayList(