Ignored/fixed some tests for Kotlin/Native
This commit is contained in:
+54
@@ -0,0 +1,54 @@
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
// FILE: 1.kt
|
||||
// WITH_RUNTIME
|
||||
// TARGET_BACKEND: NATIVE
|
||||
package test
|
||||
|
||||
open class A(val value: String)
|
||||
|
||||
var invokeOrder = ""
|
||||
|
||||
inline fun inlineFun(
|
||||
vararg constraints: A,
|
||||
receiver: String = { invokeOrder += " default receiver"; "DEFAULT" }(),
|
||||
init: String
|
||||
): String {
|
||||
return constraints.map { it.value }.joinToString() + ", " + receiver + ", " + init
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
import test.*
|
||||
|
||||
|
||||
var result = ""
|
||||
fun box(): String {
|
||||
|
||||
result = ""
|
||||
invokeOrder = ""
|
||||
result = inlineFun(constraints = { invokeOrder += "constraints";A("C") }(),
|
||||
receiver = { invokeOrder += " receiver"; "R" }(),
|
||||
init = { invokeOrder += " init"; "I" }())
|
||||
if (result != "C, R, I") return "fail 1: $result"
|
||||
|
||||
if (invokeOrder != "constraints receiver init") return "fail 2: $invokeOrder"
|
||||
|
||||
result = ""
|
||||
invokeOrder = ""
|
||||
result = inlineFun(init = { invokeOrder += "init"; "I" }(),
|
||||
constraints = { invokeOrder += "constraints";A("C") }(),
|
||||
receiver = { invokeOrder += " receiver"; "R" }()
|
||||
)
|
||||
if (result != "C, R, I") return "fail 3: $result"
|
||||
//Change test after KT-17691 FIX
|
||||
if (invokeOrder != "init receiverconstraints") return "fail 4: $invokeOrder"
|
||||
|
||||
result = ""
|
||||
invokeOrder = ""
|
||||
result = inlineFun(init = { invokeOrder += "init"; "I" }(),
|
||||
constraints = { invokeOrder += " constraints";A("C") }())
|
||||
if (result != "C, DEFAULT, I") return "fail 5: $result"
|
||||
if (invokeOrder != "init constraints default receiver") return "fail 6: $invokeOrder"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
fun foo(x: Cloneable) = x
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
@@ -5,9 +5,6 @@ operator fun String.get(vararg value: Any) : String {
|
||||
operator fun Int.get(vararg value: Any) : Int {
|
||||
return if (value[0] == 44 && value[1] == "example") 1 else 0
|
||||
}
|
||||
fun main(args: Array<String>) {
|
||||
12 [44, "example"]
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
if ("foo" [44, "example"] != "OK") return "fail1"
|
||||
|
||||
@@ -46,6 +46,14 @@ fun testFloatArray() {
|
||||
throw AssertionError()
|
||||
}
|
||||
|
||||
fun testDoubleArray() {
|
||||
DoubleArray(5) { i ->
|
||||
if (i == 3) return
|
||||
i.toDouble()
|
||||
}
|
||||
throw AssertionError()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
testArray()
|
||||
testIntArray()
|
||||
@@ -53,5 +61,6 @@ fun box(): String {
|
||||
testBooleanArray()
|
||||
testCharArray()
|
||||
testFloatArray()
|
||||
testDoubleArray()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
+3
-4
@@ -6,8 +6,7 @@ class B(): A<String>() {
|
||||
override fun f(args : Array<String>) {}
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
fun box(): String {
|
||||
B()
|
||||
}
|
||||
|
||||
fun box(): String = "OK"
|
||||
return "OK"
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// TODO: investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
// See https://youtrack.jetbrains.com/issue/KT-14938
|
||||
// WITH_REFLECT
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
fun main(args: Array<String>) {
|
||||
fun foo(args: Array<String>) {
|
||||
try {
|
||||
} finally {
|
||||
try {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
import helpers.*
|
||||
import kotlin.coroutines.experimental.*
|
||||
import kotlin.coroutines.experimental.intrinsics.*
|
||||
|
||||
-1
@@ -1,6 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
import helpers.*
|
||||
import kotlin.coroutines.experimental.*
|
||||
import kotlin.coroutines.experimental.intrinsics.*
|
||||
|
||||
Vendored
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
import helpers.*
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// CHECK_BYTECODE_LISTING
|
||||
|
||||
+1
-5
@@ -6,10 +6,6 @@ fun foo() : String {
|
||||
return u()
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
foo()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return foo()
|
||||
return foo()
|
||||
}
|
||||
@@ -1,9 +1,5 @@
|
||||
enum class En { A, B, С }
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var res1 = "fail"
|
||||
var res2 = "fail2"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
// FILE: 1.kt
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
package test
|
||||
|
||||
open class A(val value: String)
|
||||
@@ -29,7 +30,7 @@ fun box(): String {
|
||||
init = { invokeOrder += " init"; "I" }())
|
||||
if (result != "C, R, I") return "fail 1: $result"
|
||||
|
||||
//Change test after KT-17691 FIX
|
||||
//Change test after KT-17691 FIX; and remove cloned test for Native (enable this).
|
||||
if (invokeOrder != " receiver initconstraints") return "fail 2: $invokeOrder"
|
||||
|
||||
result = ""
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// FILE: 1.kt
|
||||
// LANGUAGE_VERSION: 1.2
|
||||
// SKIP_INLINE_CHECK_IN: inlineFun$default
|
||||
// IGNORE_BACKEND: JS
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
//WITH_RUNTIME
|
||||
package test
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// FILE: 1.kt
|
||||
// WITH_REFLECT
|
||||
package test
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// FILE: 1.kt
|
||||
// FULL_JDK
|
||||
// WITH_REFLECT
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
package test
|
||||
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// FILE: 1.kt
|
||||
// FULL_JDK
|
||||
// WITH_REFLECT
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
package test
|
||||
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
@@ -31,8 +31,8 @@ class ValByMapExtensionsTest {
|
||||
}
|
||||
|
||||
|
||||
|
||||
class VarByMapExtensionsTest {
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
val map = hashMapOf<String, Any?>("a" to "all", "b" to null, "c" to 1, "xProperty" to 1.0)
|
||||
val map2: MutableMap<String, CharSequence> = hashMapOf("a2" to "all")
|
||||
|
||||
@@ -66,3 +66,38 @@ class VarByMapExtensionsTest {
|
||||
assertEquals(null, d)
|
||||
}
|
||||
}
|
||||
|
||||
class VarByMapExtensionsTest_ForNative {
|
||||
val map = hashMapOf<String, Any?>("a" to "all", "b" to null, "c" to 1, "xProperty" to 1.0)
|
||||
val map2: MutableMap<String, CharSequence> = hashMapOf("a2" to "all")
|
||||
|
||||
var a: String by map
|
||||
var b: Any? by map
|
||||
var c: Int by map
|
||||
var d: String? by map
|
||||
var a2: String by map2.withDefault { "empty" }
|
||||
//var x: Int by map2 // prohibited by type system
|
||||
|
||||
@Test fun doTest() {
|
||||
assertEquals("all", a)
|
||||
assertEquals(null, b)
|
||||
assertEquals(1, c)
|
||||
c = 2
|
||||
assertEquals(2, c)
|
||||
assertEquals(2, map["c"])
|
||||
|
||||
assertEquals("all", a2)
|
||||
map2.remove("a2")
|
||||
assertEquals("empty", a2)
|
||||
|
||||
map["c"] = "string"
|
||||
// fails { c } // does not fail in JS due to KT-8135
|
||||
|
||||
map["a"] = null
|
||||
//a Fails in Native, KT-8135 is already fixed in Native. // fails { a } // does not fail due to KT-8135
|
||||
|
||||
assertFailsWith<NoSuchElementException> { d }
|
||||
map["d"] = null
|
||||
assertEquals(null, d)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user