[Tests] Migrate backend-independent tests from native to compiler/testData.
^KT-65979
This commit is contained in:
committed by
Space Team
parent
dd9332d9e1
commit
febac0dd5f
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
// WITH_STDLIB
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
val a = "a"
|
||||
|
||||
val x = object {
|
||||
override fun toString(): String {
|
||||
return foo(a) + foo("b")
|
||||
}
|
||||
|
||||
fun foo(s: String) = s + s
|
||||
}
|
||||
|
||||
assertEquals("aabb", x.toString())
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
// WITH_STDLIB
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
fun box(): String {
|
||||
val a = "OK"
|
||||
|
||||
val x = object {
|
||||
override fun toString(): String {
|
||||
return foo {
|
||||
a
|
||||
}
|
||||
}
|
||||
|
||||
fun foo(lambda: () -> String) = lambda()
|
||||
}
|
||||
|
||||
return x.toString()
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
MODULE main
|
||||
CLASS Expr3Kt.class
|
||||
PACKAGE METADATA
|
||||
PROPERTY getSb()Ljava/lang/StringBuilder;
|
||||
Property: class.metadata.property.returnType
|
||||
K1
|
||||
java/lang/StringBuilder /* = kotlin/text/StringBuilder^ */
|
||||
K2
|
||||
java/lang/StringBuilder
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
// JVM_ABI_K1_K2_DIFF: KT-63864
|
||||
// WITH_STDLIB
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
val sb = StringBuilder()
|
||||
|
||||
fun box(): String {
|
||||
var cnt = 0
|
||||
|
||||
var x: Any = ""
|
||||
|
||||
for (i in 0 .. 1) {
|
||||
sb.appendLine(x)
|
||||
cnt++
|
||||
val y = object {
|
||||
override fun toString() = cnt.toString()
|
||||
}
|
||||
x = y
|
||||
}
|
||||
sb.appendLine(x)
|
||||
|
||||
assertEquals("""
|
||||
|
||||
1
|
||||
2
|
||||
|
||||
""".trimIndent(), sb.toString())
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user