[KT-4124] Fix some tests from common testData

This commit is contained in:
Alexey Andreev
2016-02-17 11:35:16 +03:00
parent f5786dd567
commit 9238afc439
26 changed files with 68 additions and 88 deletions
@@ -1,5 +1,6 @@
// Enable for JS when it supports initializer of companion objects.
// TARGET_BACKEND: JVM
// see https://youtrack.jetbrains.com/issue/KT-11086
var global = 0;
class C {
@@ -1,4 +1,4 @@
// Enable for JS when it supports Java class library.
// TODO: Enable for JS when it supports Java class library.
// TARGET_BACKEND: JVM
class SomeClass { companion object }
+2 -2
View File
@@ -1,5 +1,5 @@
// Won't ever work with JS backend. Consider rewriting this test without using threads, since the issue
// is not about threads at all.
// Won't ever work with JS backend.
// TODO: Consider rewriting this test without using threads, since the issue is not about threads at all.
// TARGET_BACKEND: JVM
object RefreshQueue {
+1 -1
View File
@@ -1,4 +1,4 @@
// Enable when JS backend supports Java class library
// TODO: Enable when JS backend supports Java class library
// TARGET_BACKEND: JVM
public class SomeClass() : java.lang.Object() {
}
+1 -1
View File
@@ -1,4 +1,4 @@
// Enable when JS backend supports Java class library, since FunctionX are required for interoperation
// TODO: Enable when JS backend supports Java class library, since FunctionX are required for interoperation
// TARGET_BACKEND: JVM
class Works() : Function0<Any> {
public override fun invoke():Any {
-3
View File
@@ -1,9 +1,6 @@
// Enable when JS backend supports Java class library, or consider replacing System.out.println with kotlin.println
// TARGET_BACKEND: JVM
class Greeter(var name : String) {
fun greet() {
name = name.plus("")
System.out?.println("Hello, $name");
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
// Enable when JS backend supports Java class library
// TODO: Enable when JS backend supports Java class library
// TARGET_BACKEND: JVM
public open class Test(): java.util.RandomAccess, Cloneable, java.io.Serializable
{
+1 -1
View File
@@ -1,4 +1,4 @@
// Enable when JS backend supports Java class library
// TODO: Enable when JS backend supports Java class library
// TARGET_BACKEND: JVM
import java.util.AbstractList
-2
View File
@@ -1,5 +1,3 @@
// Enable when bug with when ... !in expression gets fixed
// TARGET_BACKEND: JVM
import java.util.HashSet
fun box() : String{
+1 -1
View File
@@ -1,4 +1,4 @@
// Enable when JS backend supports local classes
// TODO: Enable when JS backend supports local classes
// TARGET_BACKEND: JVM
fun box() : String {
val o = object {
-7
View File
@@ -1,5 +1,3 @@
// Enable for JS when it supports Java class library.
// TARGET_BACKEND: JVM
fun test1() : Boolean {
try {
return true
@@ -45,9 +43,7 @@ fun test4() : Int {
fun test5() : Int {
var x = 0
System.out?.println("test 5")
while(true) {
System.out?.println(x)
try {
if(x < 10)
x++
@@ -63,9 +59,7 @@ fun test5() : Int {
fun test6() : Int {
var x = 0
System.out?.println("test 6")
while(x < 10) {
System.out?.println(x)
try {
x++
continue
@@ -81,7 +75,6 @@ fun box() : String {
if(test1()) return "test1 failed"
if(test2()) return "test2 failed"
if(test3() != 2) return "test3 failed"
System.out?.println(test4())
if(test4() != 0) return "test4 failed"
if(test5() != 11) return "test5 failed"
if(test6() != 10) return "test6 failed"
-2
View File
@@ -21,8 +21,6 @@ val USER_ID_2 =
fun getUserIdFromEnvironment() : Int = throw UnsupportedOperationException()
fun box() : String {
// Probably, it's an old debugging code. JS backend still does not support this
//System.out?.println("G: " + GUEST_USER_ID + " U1:" + USER_ID + " U2: " + USER_ID_2)
if(USER_ID != 4) return "test0 failed"
if(USER_ID_2 != 4) return "test2 failed"
if(GUEST_USER_ID != 5) return "test3 failed"
-3
View File
@@ -4,9 +4,6 @@ class Reluctant() {
}
}
// Probably, it's an old debugging code. JS backend still does not support this
//fun p(o : Any?) = System.out?.println(o)
fun test1() : String {
try {
val b = Reluctant()
+13 -14
View File
@@ -1,18 +1,17 @@
// Enable for JS when it supports Java class library.
// TARGET_BACKEND: JVM
// BTW, this test does not seem relevant to real descsription of issue #KT-504
import java.util.HashMap
import java.io.*
package mult_constructors_3_bug
operator fun <K, V> MutableMap<K, V>.set(key : K, value : V) = put(key, value)
public open class Identifier() {
private var myNullable : Boolean = true
companion object {
open public fun init(isNullable : Boolean) : Identifier {
val id = Identifier()
id.myNullable = isNullable
return id
}
}
}
fun box() : String {
val commands : MutableMap<String, String> = HashMap()
commands["c1"] = "239"
if(commands["c1"] != "239") return "fail"
commands["c1"] += "932"
return if(commands["c1"] == "239932") "OK" else "fail"
Identifier.init(true)
return "OK"
}
+13 -13
View File
@@ -1,17 +1,17 @@
package mult_constructors_3_bug
// TODO: Enable for JS when it supports Java class library.
// TARGET_BACKEND: JVM
import java.util.HashMap
import java.io.*
public open class Identifier() {
private var myNullable : Boolean = true
companion object {
open public fun init(isNullable : Boolean) : Identifier {
val id = Identifier()
id.myNullable = isNullable
return id
}
}
}
operator fun <K, V> MutableMap<K, V>.set(key : K, value : V) = put(key, value)
fun box() : String {
Identifier.init(true)
return "OK"
val commands : MutableMap<String, String> = HashMap()
commands["c1"] = "239"
if(commands["c1"] != "239") return "fail"
commands["c1"] += "932"
return if(commands["c1"] == "239932") "OK" else "fail"
}
+1 -1
View File
@@ -1,4 +1,4 @@
// Enable when JS backend get support of local classes
// TODO: Enable when JS backend get support of local classes
// TARGET_BACKEND: JVM
fun test1(str: String): String {
data class A(val x: Int) {
+1 -1
View File
@@ -1,4 +1,4 @@
// Enable for JS when it supports Java class library.
// TODO: Enable for JS when it supports Java class library.
// TARGET_BACKEND: JVM
class List<T>(val head: T, val tail: List<T>? = null)
+1 -1
View File
@@ -1,4 +1,4 @@
// Enable for JS when it supports local classes.
// TODO: Enable for JS when it supports local classes.
// TARGET_BACKEND: JVM
fun testFun1(str: String): String {