From 9878b60462a5c522ecbe1965cbaff011f2955332 Mon Sep 17 00:00:00 2001 From: "Pavel V. Talanov" Date: Fri, 29 Jun 2012 13:30:46 +0400 Subject: [PATCH] Fix KotlinLibTest and remove redundant tests. --- .../k2js/test/semantics/KotlinLibTest.java | 17 -------------- .../kotlinLib/cases/commaExpression.js | 22 ------------------- .../kotlinLib/cases/isAncestorType.js | 2 +- .../kotlinLib/cases/isComplexTest.js | 10 ++++----- .../testFiles/kotlinLib/cases/isSameType.js | 2 +- .../testFiles/kotlinLib/cases/namespace.js | 4 +++- .../kotlinLib/cases/namespaceWithClasses.js | 4 ++-- 7 files changed, 12 insertions(+), 49 deletions(-) delete mode 100644 js/js.translator/testFiles/kotlinLib/cases/commaExpression.js diff --git a/js/js.tests/test/org/jetbrains/k2js/test/semantics/KotlinLibTest.java b/js/js.tests/test/org/jetbrains/k2js/test/semantics/KotlinLibTest.java index 03e895b5f10..46d23eb0a68 100644 --- a/js/js.tests/test/org/jetbrains/k2js/test/semantics/KotlinLibTest.java +++ b/js/js.tests/test/org/jetbrains/k2js/test/semantics/KotlinLibTest.java @@ -20,9 +20,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.k2js.config.EcmaVersion; import org.jetbrains.k2js.test.SingleFileTranslationTest; import org.jetbrains.k2js.test.rhino.RhinoFunctionResultChecker; -import org.jetbrains.k2js.test.rhino.RhinoResultChecker; -import org.mozilla.javascript.Context; -import org.mozilla.javascript.Scriptable; import static org.jetbrains.k2js.test.rhino.RhinoUtils.runRhinoTest; @@ -35,15 +32,6 @@ public final class KotlinLibTest extends SingleFileTranslationTest { super("kotlinLib/"); } - public void testKotlinJsLibRunsWithRhino() throws Exception { - runRhinoTest(additionalJSFiles(EcmaVersion.v3), new RhinoResultChecker() { - @Override - public void runChecks(Context context, Scriptable scope) throws Exception { - //do nothing - } - }); - } - public void testNamespaceHasDeclaredFunction() throws Exception { runJavascriptTest("namespace.js"); } @@ -68,11 +56,6 @@ public final class KotlinLibTest extends SingleFileTranslationTest { runJavascriptTest("isComplexTest.js"); } - - public void testCommaExpression() throws Exception { - runJavascriptTest("commaExpression.js"); - } - public void testArray() throws Exception { runJavascriptTest("array.js"); } diff --git a/js/js.translator/testFiles/kotlinLib/cases/commaExpression.js b/js/js.translator/testFiles/kotlinLib/cases/commaExpression.js deleted file mode 100644 index 920116c0281..00000000000 --- a/js/js.translator/testFiles/kotlinLib/cases/commaExpression.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2010-2012 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -a = 0 -f = (t = a, t1 = t, a = ++t1, t) - -test = function () { - return (f == 0) && (a == 1) -} \ No newline at end of file diff --git a/js/js.translator/testFiles/kotlinLib/cases/isAncestorType.js b/js/js.translator/testFiles/kotlinLib/cases/isAncestorType.js index d290b0ac269..9deb036320d 100644 --- a/js/js.translator/testFiles/kotlinLib/cases/isAncestorType.js +++ b/js/js.translator/testFiles/kotlinLib/cases/isAncestorType.js @@ -18,6 +18,6 @@ var A = Kotlin.createClass(); var B = Kotlin.createClass(A); var b = new B; -test = function() { +function test() { return (Kotlin.isType(b, A) && Kotlin.isType(b, B)); } diff --git a/js/js.translator/testFiles/kotlinLib/cases/isComplexTest.js b/js/js.translator/testFiles/kotlinLib/cases/isComplexTest.js index e50a0e99645..bf741b09ff3 100644 --- a/js/js.translator/testFiles/kotlinLib/cases/isComplexTest.js +++ b/js/js.translator/testFiles/kotlinLib/cases/isComplexTest.js @@ -22,19 +22,19 @@ var c = new C; var E = Kotlin.createClass(A) var e = new E; -test1 = function() { - b2 = b +var test1 = function() { + var b2 = b return (Kotlin.isType(b, A) && Kotlin.isType(b, B)); } -test2 = function() { +var test2 = function() { return (Kotlin.isType(c, C) && Kotlin.isType(c, B) && Kotlin.isType(c, A) && (!Kotlin.isType(c, E))); } -test3 = function() { +var test3 = function() { return Kotlin.isType(e, E) && !Kotlin.isType(e, B) && !Kotlin.isType(e, C) && Kotlin.isType(e, A) } -test = function() { +var test = function() { return test1() && test2() && test3() } diff --git a/js/js.translator/testFiles/kotlinLib/cases/isSameType.js b/js/js.translator/testFiles/kotlinLib/cases/isSameType.js index e2abd90c636..4d36530fac0 100644 --- a/js/js.translator/testFiles/kotlinLib/cases/isSameType.js +++ b/js/js.translator/testFiles/kotlinLib/cases/isSameType.js @@ -17,6 +17,6 @@ var A = Kotlin.createClass(); var a = Kotlin.$new(A)(); -test = function() { +function test() { return Kotlin.isType(a, A); } diff --git a/js/js.translator/testFiles/kotlinLib/cases/namespace.js b/js/js.translator/testFiles/kotlinLib/cases/namespace.js index 2348996f0a9..e07927c51a0 100644 --- a/js/js.translator/testFiles/kotlinLib/cases/namespace.js +++ b/js/js.translator/testFiles/kotlinLib/cases/namespace.js @@ -14,7 +14,9 @@ * limitations under the License. */ -foo = Kotlin.createNamespace({initialize:function(){ + + +var foo = Kotlin.createNamespace({initialize:function(){ } , box:function(){ return !false; diff --git a/js/js.translator/testFiles/kotlinLib/cases/namespaceWithClasses.js b/js/js.translator/testFiles/kotlinLib/cases/namespaceWithClasses.js index 69a33df0984..6c342414a7a 100644 --- a/js/js.translator/testFiles/kotlinLib/cases/namespaceWithClasses.js +++ b/js/js.translator/testFiles/kotlinLib/cases/namespaceWithClasses.js @@ -15,7 +15,7 @@ */ { - classes = function(){ + var classes = function(){ var A = Kotlin.createClass({initialize:function(){ this.$order = ''; { @@ -46,7 +46,7 @@ return {A:A, B:B, C:C}; } (); - foo = Kotlin.createNamespace(classes, {initialize:function(){ + var foo = Kotlin.createNamespace(classes, {initialize:function(){ } , box:function(){ return (new foo.C).get_order() === 'ABC' && (new foo.B).get_order() === 'AB' && (new foo.A).get_order() === 'A';