diff --git a/js/js.tests/test/org/jetbrains/k2js/test/semantics/ClassInheritanceTest.java b/js/js.tests/test/org/jetbrains/k2js/test/semantics/ClassInheritanceTest.java index c76656841c7..f76feaa0b1a 100644 --- a/js/js.tests/test/org/jetbrains/k2js/test/semantics/ClassInheritanceTest.java +++ b/js/js.tests/test/org/jetbrains/k2js/test/semantics/ClassInheritanceTest.java @@ -29,7 +29,15 @@ public final class ClassInheritanceTest extends SingleFileTranslationTest { } public void testMethodOverride() throws Exception { - fooBoxTest(); + checkFooBoxIsOk(); + } + + public void testBaseCall() throws Exception { + checkFooBoxIsOk(); + } + + public void testCrazyInheritance() throws Exception { + checkFooBoxIsOk(); } public void testValOverride() throws Exception { diff --git a/js/js.tests/test/org/jetbrains/k2js/test/semantics/ClassObjectTest.java b/js/js.tests/test/org/jetbrains/k2js/test/semantics/ClassObjectTest.java index 52ebeb313c0..5f926523508 100644 --- a/js/js.tests/test/org/jetbrains/k2js/test/semantics/ClassObjectTest.java +++ b/js/js.tests/test/org/jetbrains/k2js/test/semantics/ClassObjectTest.java @@ -5,7 +5,7 @@ import org.jetbrains.k2js.test.SingleFileTranslationTest; public final class ClassObjectTest extends SingleFileTranslationTest { public ClassObjectTest() { - super("class_object/"); + super("classObject/"); } public void testSimple() throws Exception { diff --git a/js/js.tests/test/org/jetbrains/k2js/test/semantics/DelegatePropertyTest.java b/js/js.tests/test/org/jetbrains/k2js/test/semantics/DelegatePropertyTest.java index a812bd39f5d..e0b713cf01e 100644 --- a/js/js.tests/test/org/jetbrains/k2js/test/semantics/DelegatePropertyTest.java +++ b/js/js.tests/test/org/jetbrains/k2js/test/semantics/DelegatePropertyTest.java @@ -35,6 +35,9 @@ public class DelegatePropertyTest extends SingleFileTranslationTest { checkFooBoxIsOk(); } + public void testDelegateWithPropertyAccess() throws Exception { + checkFooBoxIsOk(); + } public void testDelegateByTopLevelFun() throws Exception { checkFooBoxIsOk(); diff --git a/js/js.tests/test/org/jetbrains/k2js/test/semantics/InitializerTest.java b/js/js.tests/test/org/jetbrains/k2js/test/semantics/InitializerTest.java new file mode 100644 index 00000000000..bffd5ef1020 --- /dev/null +++ b/js/js.tests/test/org/jetbrains/k2js/test/semantics/InitializerTest.java @@ -0,0 +1,37 @@ +/* + * Copyright 2010-2013 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. + */ + +package org.jetbrains.k2js.test.semantics; + +import org.jetbrains.k2js.test.SingleFileTranslationTest; + +public class InitializerTest extends SingleFileTranslationTest { + public InitializerTest() { + super("initialize/"); + } + + public void testRootValInit() throws Exception { + checkFooBoxIsOk(); + } + + public void testRootPackageValInit() throws Exception { + runFunctionOutputTest(DEFAULT_ECMA_VERSIONS, getTestName(true) + ".kt", "_", "box", "OK"); + } + + public void testClassInitializer() throws Exception { + checkFooBoxIsOk(); + } +} diff --git a/js/js.tests/test/org/jetbrains/k2js/test/semantics/NameClashesTest.java b/js/js.tests/test/org/jetbrains/k2js/test/semantics/NameClashesTest.java index 29ffe1c0871..36ad406d7d7 100644 --- a/js/js.tests/test/org/jetbrains/k2js/test/semantics/NameClashesTest.java +++ b/js/js.tests/test/org/jetbrains/k2js/test/semantics/NameClashesTest.java @@ -29,9 +29,11 @@ public final class NameClashesTest extends SingleFileTranslationTest { fooBoxTest(); } - //TODO: - @SuppressWarnings("UnusedDeclaration") - public void TODO_testDifferenceInCapitalization() throws Exception { - fooBoxTest(); + public void testOverloadExtension() throws Exception { + checkFooBoxIsOk(); + } + + public void testDifferenceInCapitalization() throws Exception { + checkFooBoxIsOk(); } } \ No newline at end of file diff --git a/js/js.tests/test/org/jetbrains/k2js/test/semantics/PropertyAccessTest.java b/js/js.tests/test/org/jetbrains/k2js/test/semantics/PropertyAccessTest.java index 5c66513ea2b..ac63248aefa 100644 --- a/js/js.tests/test/org/jetbrains/k2js/test/semantics/PropertyAccessTest.java +++ b/js/js.tests/test/org/jetbrains/k2js/test/semantics/PropertyAccessTest.java @@ -39,6 +39,9 @@ public final class PropertyAccessTest extends SingleFileTranslationTest { fooBoxTest(); } + public void testBackendField() throws Exception { + checkFooBoxIsOk(); + } public void testSetter() throws Exception { runFunctionOutputTest("setter.kt", "foo", "f", 99.0); diff --git a/js/js.tests/test/org/jetbrains/k2js/test/semantics/RTTITest.java b/js/js.tests/test/org/jetbrains/k2js/test/semantics/RTTITest.java index 538185304c6..bd8d86e84bd 100644 --- a/js/js.tests/test/org/jetbrains/k2js/test/semantics/RTTITest.java +++ b/js/js.tests/test/org/jetbrains/k2js/test/semantics/RTTITest.java @@ -24,6 +24,10 @@ public class RTTITest extends SingleFileTranslationTest { super("rtti/"); } + public void testRttiForClass() throws Exception { + checkFooBoxIsOk(); + } + public void testIsSameClass() throws Exception { fooBoxTest(); } diff --git a/js/js.tests/test/org/jetbrains/k2js/test/semantics/RegressionMergeEcmaTest.java b/js/js.tests/test/org/jetbrains/k2js/test/semantics/RegressionMergeEcmaTest.java deleted file mode 100644 index 033000fca84..00000000000 --- a/js/js.tests/test/org/jetbrains/k2js/test/semantics/RegressionMergeEcmaTest.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2010-2013 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. - */ - -package org.jetbrains.k2js.test.semantics; - -import org.jetbrains.k2js.test.SingleFileTranslationTest; - -public class RegressionMergeEcmaTest extends SingleFileTranslationTest { - public RegressionMergeEcmaTest() { - super("mergeEcma/"); - } - - public void testObjectWithMethods() throws Exception { - fooBoxTest(); - } - - public void testEcmaDelegate() throws Exception { - checkFooBoxIsOk(); - } - - public void testEcmaObject() throws Exception { - checkFooBoxIsOk(); - } - - public void testEcmaSimple() throws Exception { - checkFooBoxIsOk(); - } - - public void testMethodOverride() throws Exception { - checkFooBoxIsOk(); - } - - public void testMethodInClass() throws Exception { - checkFooBoxIsOk(); - } - - public void testGetSetProperty() throws Exception { - checkFooBoxIsOk(); - } - - public void testRootValInit() throws Exception { - checkFooBoxIsOk(); - } - - public void testRootPackageValInit() throws Exception { - runFunctionOutputTest(DEFAULT_ECMA_VERSIONS, getTestName(true) + ".kt", "_", "box", "OK"); - } - - public void testIsClassSupport() throws Exception { - checkFooBoxIsOk(); - } - - public void testCrazyExtension() throws Exception { - checkFooBoxIsOk(); - } - - public void testOverloadFun() throws Exception { - checkFooBoxIsOk(); - } - - public void testLiteralFun() throws Exception { - checkFooBoxIsOk(); - } - - public void testOverloadExtension() throws Exception { - checkFooBoxIsOk(); - } - - public void testClassInitializer() throws Exception { - checkFooBoxIsOk(); - } - - public void testBackendField() throws Exception { - checkFooBoxIsOk(); - } - - public void testExtensionClass() throws Exception { - checkFooBoxIsOk(); - } -} diff --git a/js/js.translator/testFiles/class_object/cases/setVar.kt b/js/js.translator/testFiles/classObject/cases/setVar.kt similarity index 100% rename from js/js.translator/testFiles/class_object/cases/setVar.kt rename to js/js.translator/testFiles/classObject/cases/setVar.kt diff --git a/js/js.translator/testFiles/class_object/cases/simple.kt b/js/js.translator/testFiles/classObject/cases/simple.kt similarity index 100% rename from js/js.translator/testFiles/class_object/cases/simple.kt rename to js/js.translator/testFiles/classObject/cases/simple.kt diff --git a/js/js.translator/testFiles/class_object/cases/withExtension.kt b/js/js.translator/testFiles/classObject/cases/withExtension.kt similarity index 100% rename from js/js.translator/testFiles/class_object/cases/withExtension.kt rename to js/js.translator/testFiles/classObject/cases/withExtension.kt diff --git a/js/js.translator/testFiles/mergeEcma/cases/ecmaDelegate.kt b/js/js.translator/testFiles/delegateProperty/cases/delegateWithPropertyAccess.kt similarity index 100% rename from js/js.translator/testFiles/mergeEcma/cases/ecmaDelegate.kt rename to js/js.translator/testFiles/delegateProperty/cases/delegateWithPropertyAccess.kt diff --git a/js/js.translator/testFiles/mergeEcma/cases/extensionClass.kt b/js/js.translator/testFiles/inheritance/cases/baseCall.kt similarity index 100% rename from js/js.translator/testFiles/mergeEcma/cases/extensionClass.kt rename to js/js.translator/testFiles/inheritance/cases/baseCall.kt diff --git a/js/js.translator/testFiles/mergeEcma/cases/crazyExtension.kt b/js/js.translator/testFiles/inheritance/cases/crazyInheritance.kt similarity index 100% rename from js/js.translator/testFiles/mergeEcma/cases/crazyExtension.kt rename to js/js.translator/testFiles/inheritance/cases/crazyInheritance.kt diff --git a/js/js.translator/testFiles/inheritance/cases/methodOverride.kt b/js/js.translator/testFiles/inheritance/cases/methodOverride.kt index 62feff89b9b..e25befd297f 100644 --- a/js/js.translator/testFiles/inheritance/cases/methodOverride.kt +++ b/js/js.translator/testFiles/inheritance/cases/methodOverride.kt @@ -1,15 +1,27 @@ package foo -open class C() { - open fun f(): Any = "C f" +open class A { + fun f1(): Int { + return 1 + } + open fun f2(): Int { + return 3 + } } -class D() : C() { - override fun f(): String = "D f" +class B: A() { + override fun f2(): Int { + return 2 + } } -fun box(): Boolean { - val d : C = D() - if(d.f() != "D f") return false - return true +fun box(): String { + val a = A() + if (a.f1() != 1) return "a.f1() != 1, it: ${a.f1()}" + if (a.f2() != 3) return "a.f2() != 3, it: ${a.f2()}" + + val b = B(); + if (b.f1() != 1) return "b.f1() != 1, it: ${b.f1()}" + if (b.f2() != 2) return "b.f2() != 2, it: ${b.f2()}" + return "OK" } \ No newline at end of file diff --git a/js/js.translator/testFiles/mergeEcma/cases/classInitializer.kt b/js/js.translator/testFiles/initialize/cases/classInitializer.kt similarity index 100% rename from js/js.translator/testFiles/mergeEcma/cases/classInitializer.kt rename to js/js.translator/testFiles/initialize/cases/classInitializer.kt diff --git a/js/js.translator/testFiles/mergeEcma/cases/rootPackageValInit.kt b/js/js.translator/testFiles/initialize/cases/rootPackageValInit.kt similarity index 100% rename from js/js.translator/testFiles/mergeEcma/cases/rootPackageValInit.kt rename to js/js.translator/testFiles/initialize/cases/rootPackageValInit.kt diff --git a/js/js.translator/testFiles/mergeEcma/cases/rootValInit.kt b/js/js.translator/testFiles/initialize/cases/rootValInit.kt similarity index 100% rename from js/js.translator/testFiles/mergeEcma/cases/rootValInit.kt rename to js/js.translator/testFiles/initialize/cases/rootValInit.kt diff --git a/js/js.translator/testFiles/mergeEcma/cases/backendField.kt b/js/js.translator/testFiles/mergeEcma/cases/backendField.kt deleted file mode 100644 index c4d774c8503..00000000000 --- a/js/js.translator/testFiles/mergeEcma/cases/backendField.kt +++ /dev/null @@ -1,9 +0,0 @@ -package foo - -val a: Int = 1 - get() = $a + 1 - -fun box(): String { - if (a != 2) return "a != 2, it: $a" - return "OK" -} \ No newline at end of file diff --git a/js/js.translator/testFiles/mergeEcma/cases/ecmaObject.kt b/js/js.translator/testFiles/mergeEcma/cases/ecmaObject.kt deleted file mode 100644 index 22655927dd7..00000000000 --- a/js/js.translator/testFiles/mergeEcma/cases/ecmaObject.kt +++ /dev/null @@ -1,14 +0,0 @@ -package foo - -open class A(val name: String) { - fun foo(): String { - return name - } -} - -object B : A("OK") - -fun box(): String { - val OK = B.foo() - return OK -} \ No newline at end of file diff --git a/js/js.translator/testFiles/mergeEcma/cases/ecmaSimple.kt b/js/js.translator/testFiles/mergeEcma/cases/ecmaSimple.kt deleted file mode 100644 index c7a16af175f..00000000000 --- a/js/js.translator/testFiles/mergeEcma/cases/ecmaSimple.kt +++ /dev/null @@ -1,12 +0,0 @@ -package foo - -open class A { - val a = "OK" -} - -class B: A() - -fun box(): String { - - return B().a -} \ No newline at end of file diff --git a/js/js.translator/testFiles/mergeEcma/cases/getSetProperty.kt b/js/js.translator/testFiles/mergeEcma/cases/getSetProperty.kt deleted file mode 100644 index fdf5784051a..00000000000 --- a/js/js.translator/testFiles/mergeEcma/cases/getSetProperty.kt +++ /dev/null @@ -1,27 +0,0 @@ -package foo - -class A { - val a: Int - get() { - return 2 - } - - var b: Int = 1 - get() { - return $b + 1; - } - set(value: Int) { - $b = value; - } -} - -fun box(): String { - val a = A() - if (a.a != 2) return "a.a != 2, it: ${a.a}" - - if (a.b != 2) return "a.b != 2, it: ${a.b}" - a.b = 3 - - if (a.b != 4) return "a.b != 4, it: ${a.b}" - return "OK" -} \ No newline at end of file diff --git a/js/js.translator/testFiles/mergeEcma/cases/literalFun.kt b/js/js.translator/testFiles/mergeEcma/cases/literalFun.kt deleted file mode 100644 index 8bf4f16ee81..00000000000 --- a/js/js.translator/testFiles/mergeEcma/cases/literalFun.kt +++ /dev/null @@ -1,9 +0,0 @@ -package foo - -fun ok(f: (s: String) -> String): String { - return f("O"); -} - -fun box(): String { - return ok { (s) -> s + "K" } -} \ No newline at end of file diff --git a/js/js.translator/testFiles/mergeEcma/cases/methodInClass.kt b/js/js.translator/testFiles/mergeEcma/cases/methodInClass.kt deleted file mode 100644 index ab5bfaadc46..00000000000 --- a/js/js.translator/testFiles/mergeEcma/cases/methodInClass.kt +++ /dev/null @@ -1,14 +0,0 @@ -package foo - -class A { - fun foo(): Int { - return 1 - } - -} - -fun box(): String { - val a = A() - if (a.foo() != 1) return "a.foo() != 1, it: ${a.foo()}" - return "OK" -} \ No newline at end of file diff --git a/js/js.translator/testFiles/mergeEcma/cases/methodOverride.kt b/js/js.translator/testFiles/mergeEcma/cases/methodOverride.kt deleted file mode 100644 index e25befd297f..00000000000 --- a/js/js.translator/testFiles/mergeEcma/cases/methodOverride.kt +++ /dev/null @@ -1,27 +0,0 @@ -package foo - -open class A { - fun f1(): Int { - return 1 - } - open fun f2(): Int { - return 3 - } -} - -class B: A() { - override fun f2(): Int { - return 2 - } -} - -fun box(): String { - val a = A() - if (a.f1() != 1) return "a.f1() != 1, it: ${a.f1()}" - if (a.f2() != 3) return "a.f2() != 3, it: ${a.f2()}" - - val b = B(); - if (b.f1() != 1) return "b.f1() != 1, it: ${b.f1()}" - if (b.f2() != 2) return "b.f2() != 2, it: ${b.f2()}" - return "OK" -} \ No newline at end of file diff --git a/js/js.translator/testFiles/mergeEcma/cases/objectWithMethods.kt b/js/js.translator/testFiles/mergeEcma/cases/objectWithMethods.kt deleted file mode 100644 index a05fd859306..00000000000 --- a/js/js.translator/testFiles/mergeEcma/cases/objectWithMethods.kt +++ /dev/null @@ -1,22 +0,0 @@ -package foo - -class Test { - private val a = object { - fun c() = 3 - fun b() = 2 - } - - fun doTest(): Boolean { - if (a.c() != 3) { - return false; - } - if (a.b() != 2) { - return false; - } - return true; - } -} - -fun box(): Boolean { - return Test().doTest(); -} diff --git a/js/js.translator/testFiles/mergeEcma/cases/overloadFun.kt b/js/js.translator/testFiles/mergeEcma/cases/overloadFun.kt deleted file mode 100644 index 5a785d23091..00000000000 --- a/js/js.translator/testFiles/mergeEcma/cases/overloadFun.kt +++ /dev/null @@ -1,12 +0,0 @@ -package foo - -class A { - fun test(a: Int) {} - fun test() {} -} - - -fun box(): String { - - return "OK" -} \ No newline at end of file diff --git a/js/js.translator/testFiles/mergeEcma/cases/overloadExtension.kt b/js/js.translator/testFiles/nameClashes/cases/overloadExtension.kt similarity index 100% rename from js/js.translator/testFiles/mergeEcma/cases/overloadExtension.kt rename to js/js.translator/testFiles/nameClashes/cases/overloadExtension.kt diff --git a/js/js.translator/testFiles/propertyAccess/cases/backendField.kt b/js/js.translator/testFiles/propertyAccess/cases/backendField.kt new file mode 100644 index 00000000000..b8fe881b687 --- /dev/null +++ b/js/js.translator/testFiles/propertyAccess/cases/backendField.kt @@ -0,0 +1,17 @@ +package foo + +class A { + val a: Int = 1 + get() = $a + 1 + + fun getA(): Int { + return $a + } +} + +fun box(): String { + val a = A() + if (a.a != 2) return "A().a != 2, it: ${a.a}" + if (a.getA() != 1) return "A().getA() != 1, it: ${a.getA()}" + return "OK" +} \ No newline at end of file diff --git a/js/js.translator/testFiles/mergeEcma/cases/isClassSupport.kt b/js/js.translator/testFiles/rtti/cases/rttiForClass.kt similarity index 100% rename from js/js.translator/testFiles/mergeEcma/cases/isClassSupport.kt rename to js/js.translator/testFiles/rtti/cases/rttiForClass.kt