Fix KotlinLibTest and remove redundant tests.

This commit is contained in:
Pavel V. Talanov
2012-06-29 13:30:46 +04:00
parent 49c6555e5e
commit 9878b60462
7 changed files with 12 additions and 49 deletions
@@ -20,9 +20,6 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.k2js.config.EcmaVersion; import org.jetbrains.k2js.config.EcmaVersion;
import org.jetbrains.k2js.test.SingleFileTranslationTest; import org.jetbrains.k2js.test.SingleFileTranslationTest;
import org.jetbrains.k2js.test.rhino.RhinoFunctionResultChecker; 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; import static org.jetbrains.k2js.test.rhino.RhinoUtils.runRhinoTest;
@@ -35,15 +32,6 @@ public final class KotlinLibTest extends SingleFileTranslationTest {
super("kotlinLib/"); 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 { public void testNamespaceHasDeclaredFunction() throws Exception {
runJavascriptTest("namespace.js"); runJavascriptTest("namespace.js");
} }
@@ -68,11 +56,6 @@ public final class KotlinLibTest extends SingleFileTranslationTest {
runJavascriptTest("isComplexTest.js"); runJavascriptTest("isComplexTest.js");
} }
public void testCommaExpression() throws Exception {
runJavascriptTest("commaExpression.js");
}
public void testArray() throws Exception { public void testArray() throws Exception {
runJavascriptTest("array.js"); runJavascriptTest("array.js");
} }
@@ -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)
}
@@ -18,6 +18,6 @@ var A = Kotlin.createClass();
var B = Kotlin.createClass(A); var B = Kotlin.createClass(A);
var b = new B; var b = new B;
test = function() { function test() {
return (Kotlin.isType(b, A) && Kotlin.isType(b, B)); return (Kotlin.isType(b, A) && Kotlin.isType(b, B));
} }
@@ -22,19 +22,19 @@ var c = new C;
var E = Kotlin.createClass(A) var E = Kotlin.createClass(A)
var e = new E; var e = new E;
test1 = function() { var test1 = function() {
b2 = b var b2 = b
return (Kotlin.isType(b, A) && Kotlin.isType(b, 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))); 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) 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() return test1() && test2() && test3()
} }
@@ -17,6 +17,6 @@
var A = Kotlin.createClass(); var A = Kotlin.createClass();
var a = Kotlin.$new(A)(); var a = Kotlin.$new(A)();
test = function() { function test() {
return Kotlin.isType(a, A); return Kotlin.isType(a, A);
} }
@@ -14,7 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
foo = Kotlin.createNamespace({initialize:function(){
var foo = Kotlin.createNamespace({initialize:function(){
} }
, box:function(){ , box:function(){
return !false; return !false;
@@ -15,7 +15,7 @@
*/ */
{ {
classes = function(){ var classes = function(){
var A = Kotlin.createClass({initialize:function(){ var A = Kotlin.createClass({initialize:function(){
this.$order = ''; this.$order = '';
{ {
@@ -46,7 +46,7 @@
return {A:A, B:B, C:C}; return {A:A, B:B, C:C};
} }
(); ();
foo = Kotlin.createNamespace(classes, {initialize:function(){ var foo = Kotlin.createNamespace(classes, {initialize:function(){
} }
, box:function(){ , box:function(){
return (new foo.C).get_order() === 'ABC' && (new foo.B).get_order() === 'AB' && (new foo.A).get_order() === 'A'; return (new foo.C).get_order() === 'ABC' && (new foo.B).get_order() === 'AB' && (new foo.A).get_order() === 'A';