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 deleted file mode 100644 index 4d98ea65fa8..00000000000 --- a/js/js.tests/test/org/jetbrains/k2js/test/semantics/KotlinLibTest.java +++ /dev/null @@ -1,76 +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.annotations.NotNull; -import org.jetbrains.k2js.config.EcmaVersion; -import org.jetbrains.k2js.test.SingleFileTranslationTest; -import org.jetbrains.k2js.test.rhino.RhinoFunctionResultChecker; - -import static org.jetbrains.k2js.test.rhino.RhinoUtils.runRhinoTest; - -public final class KotlinLibTest extends SingleFileTranslationTest { - - public KotlinLibTest() { - super("kotlinLib/"); - } - - public void testPackageHasDeclaredFunction() throws Exception { - runJavascriptTest("package.js"); - } - - - public void testPackageHasDeclaredClasses() throws Exception { - runJavascriptTest("packageWithClasses.js"); - } - - - public void testIsSameType() throws Exception { - runJavascriptTest("isSameType.js"); - } - - - public void testIsAncestorType() throws Exception { - runJavascriptTest("isAncestorType.js"); - } - - - public void testIsComplexTest() throws Exception { - runJavascriptTest("isComplexTest.js"); - } - - public void testArray() throws Exception { - runJavascriptTest("array.js"); - } - - - public void testHashMap() throws Exception { - runJavascriptTest("hashMap.js"); - } - - - private void runJavascriptTest(@NotNull String filename) throws Exception { - runRhinoTest(withAdditionalFiles(cases(filename), EcmaVersion.defaultVersion()), - new RhinoFunctionResultChecker("test", true)); - } - - @Override - protected boolean shouldCreateOut() { - return false; - } - -} diff --git a/js/js.translator/testFiles/kotlinLib/cases/array.js b/js/js.translator/testFiles/kotlinLib/cases/array.js deleted file mode 100644 index 49244ab9d1a..00000000000 --- a/js/js.translator/testFiles/kotlinLib/cases/array.js +++ /dev/null @@ -1,22 +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. - */ - -function test() { - var a = Kotlin.arrayFromFun(3, function () { - return 3 - }); - return (a[0] == 3) && (a[2] == 3) && (a[1] == 3); -} \ No newline at end of file diff --git a/js/js.translator/testFiles/kotlinLib/cases/hashMap.js b/js/js.translator/testFiles/kotlinLib/cases/hashMap.js deleted file mode 100644 index b9188487c51..00000000000 --- a/js/js.translator/testFiles/kotlinLib/cases/hashMap.js +++ /dev/null @@ -1,41 +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. - */ - -var map = new Kotlin.HashMap(); - -map.put_5yfy9u$(3, 4); -map.put_5yfy9u$(6, 3); - -function test() { - if (map.containsKey(4) || map.containsKey(5)) return false; - if (map.containsKey({}) || map.containsKey(11)) return false; - if (!map.containsKey(3) || !map.containsKey(6)) return false; - var obj = map.get(3); - if (obj !== 4) return false; - obj = map.get(6); - if (obj !== 3) return false; - if (map.size() !== 2) return false; - map.put_5yfy9u$(2, 3); - if (map.size() !== 3) return false; - if (!map.containsKey(2) || !map.containsKey(3) || !map.containsKey(6)) return false; - if (!map.containsValue(4) || !map.containsValue(3)) return false; - map.put_5yfy9u$(2, 1000); - if (map.size() !== 3) return false; - if (map.get(2)!== 1000) return false; - - - return true; -} diff --git a/js/js.translator/testFiles/kotlinLib/cases/isAncestorType.js b/js/js.translator/testFiles/kotlinLib/cases/isAncestorType.js deleted file mode 100644 index a4694167c85..00000000000 --- a/js/js.translator/testFiles/kotlinLib/cases/isAncestorType.js +++ /dev/null @@ -1,23 +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. - */ - -var A = Kotlin.createClassNow(); -var B = Kotlin.createClassNow(A); -var b = new B; - -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 deleted file mode 100644 index 18ce4776603..00000000000 --- a/js/js.translator/testFiles/kotlinLib/cases/isComplexTest.js +++ /dev/null @@ -1,40 +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. - */ - -var A = Kotlin.createClassNow(); -var B = Kotlin.createClassNow(A); -var b = new B; -var C = Kotlin.createClassNow(B); -var c = new C; -var E = Kotlin.createClassNow(A); -var e = new E; - -var test1 = function() { - var b2 = b; - return (Kotlin.isType(b, A) && Kotlin.isType(b, B)); -}; - -var test2 = function() { - return (Kotlin.isType(c, C) && Kotlin.isType(c, B) && Kotlin.isType(c, A) && (!Kotlin.isType(c, E))); -}; - -var test3 = function() { - return Kotlin.isType(e, E) && !Kotlin.isType(e, B) && !Kotlin.isType(e, C) && Kotlin.isType(e, A) -}; - -var test = function() { - return test1() && test2() && test3() -}; diff --git a/js/js.translator/testFiles/kotlinLib/cases/isNotOtherType.js b/js/js.translator/testFiles/kotlinLib/cases/isNotOtherType.js deleted file mode 100644 index bbb008e27d3..00000000000 --- a/js/js.translator/testFiles/kotlinLib/cases/isNotOtherType.js +++ /dev/null @@ -1,24 +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. - */ - -var A = Kotlin.createClassNow(); -var B = Kotlin.createClassNow(A); -var C = Kotlin.createClassNow(); -var c = new C; - -test = function() { - return ((!Kotlin.isType(c, A)) && !Kotlin.isType(c, B)); -}; diff --git a/js/js.translator/testFiles/kotlinLib/cases/isSameType.js b/js/js.translator/testFiles/kotlinLib/cases/isSameType.js deleted file mode 100644 index 4d0303f2cee..00000000000 --- a/js/js.translator/testFiles/kotlinLib/cases/isSameType.js +++ /dev/null @@ -1,22 +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. - */ - -var A = Kotlin.createClassNow(); -var a = new A(); - -function test() { - return Kotlin.isType(a, A); -} diff --git a/js/js.translator/testFiles/kotlinLib/cases/package.js b/js/js.translator/testFiles/kotlinLib/cases/package.js deleted file mode 100644 index 015c2b4ef75..00000000000 --- a/js/js.translator/testFiles/kotlinLib/cases/package.js +++ /dev/null @@ -1,25 +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. - */ - -var foo = Kotlin.defineRootPackage(null, { - box: function () { - return !false; - } - }); - -function test() { - return foo.box() -} diff --git a/js/js.translator/testFiles/kotlinLib/cases/packageWithClasses.js b/js/js.translator/testFiles/kotlinLib/cases/packageWithClasses.js deleted file mode 100644 index 6d0f8e88180..00000000000 --- a/js/js.translator/testFiles/kotlinLib/cases/packageWithClasses.js +++ /dev/null @@ -1,58 +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. - */ - -{ - var items = function () { - var A = Kotlin.createClassNow(null, - function $fun() { - this.$order = ''; - { - this.set_order(this.get_order() + 'A'); - } - }, - { - set_order: function (tmp$0) { - this.$order = tmp$0; - }, - get_order: function () { - return this.$order; - } - }); - var B = Kotlin.createClassNow(A, function $fun() { - $fun.baseInitializer.call(this); - { - this.set_order(this.get_order() + 'B'); - } - }); - var C = Kotlin.createClassNow(B, function $fun() { - $fun.baseInitializer.call(this); - { - this.set_order(this.get_order() + 'C'); - } - }); - return {A: A, B: B, C: C}; - }(); - - items.box = function () { - return (new foo.C).get_order() === 'ABC' && (new foo.B).get_order() === 'AB' && (new foo.A).get_order() === 'A'; - }; - - var foo = Kotlin.defineRootPackage(null, items); -} - -function test() { - return foo.box() -} diff --git a/js/js.translator/testFiles/kotlinLib/cases/trait.js b/js/js.translator/testFiles/kotlinLib/cases/trait.js deleted file mode 100644 index faad981f58d..00000000000 --- a/js/js.translator/testFiles/kotlinLib/cases/trait.js +++ /dev/null @@ -1,28 +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. - */ - -foo = {}; -(function(foo){ - foo.Test = Kotlin.createTrait({addFoo:function(s){ - return s + 'FOO'; - } - }); - foo.ExtendedTest = Kotlin.createTrait(foo.Test, {hooray:function(){ - return 'hooray'; - } - }); -} -(foo));