[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,9 @@
|
||||
MODULE main
|
||||
CLASS GlobalIsInitializedKt.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,29 @@
|
||||
/*
|
||||
* 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()
|
||||
|
||||
lateinit var s: String
|
||||
|
||||
fun foo() {
|
||||
sb.appendLine(::s.isInitialized)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
foo()
|
||||
s = "zzz"
|
||||
foo()
|
||||
|
||||
assertEquals("""
|
||||
false
|
||||
true
|
||||
|
||||
""".trimIndent(), sb.toString())
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* 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.*
|
||||
|
||||
class A(val a: Int)
|
||||
|
||||
open class B {
|
||||
lateinit var a: A
|
||||
}
|
||||
|
||||
class C: B() {
|
||||
fun foo() { a = A(42) }
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val c = C()
|
||||
c.foo()
|
||||
assertEquals(42, c.a.a)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* 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.*
|
||||
|
||||
class A {
|
||||
lateinit var s: String
|
||||
|
||||
fun foo() = s
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val a = A()
|
||||
a.s = "OK"
|
||||
return a.foo()
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* 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.*
|
||||
|
||||
open class Foo {
|
||||
lateinit var bar: String
|
||||
|
||||
fun test(): String {
|
||||
return InnerSubclass().testInner()
|
||||
}
|
||||
|
||||
inner class InnerSubclass : Foo() {
|
||||
fun testInner(): String {
|
||||
// This is access to InnerSubclass.bar which is inherited from Foo.bar
|
||||
if (this::bar.isInitialized) return "Fail"
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Foo().test()
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
MODULE main
|
||||
CLASS IsInitializedKt.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,32 @@
|
||||
/*
|
||||
* 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()
|
||||
|
||||
class A {
|
||||
lateinit var s: String
|
||||
|
||||
fun foo() {
|
||||
sb.appendLine(::s.isInitialized)
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val a = A()
|
||||
a.foo()
|
||||
a.s = "zzz"
|
||||
a.foo()
|
||||
|
||||
assertEquals("""
|
||||
false
|
||||
true
|
||||
|
||||
""".trimIndent(), sb.toString())
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* 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 {
|
||||
lateinit var s: String
|
||||
|
||||
fun foo() = s
|
||||
|
||||
s = "OK"
|
||||
return foo()
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
MODULE main
|
||||
CLASS LocalCapturedNotInitializedKt.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,25 @@
|
||||
/*
|
||||
* 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 {
|
||||
lateinit var s: String
|
||||
|
||||
fun foo() = s
|
||||
|
||||
try {
|
||||
sb.appendLine(foo())
|
||||
}
|
||||
catch (e: RuntimeException) {
|
||||
sb.append("OK")
|
||||
return sb.toString()
|
||||
}
|
||||
return "Fail"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* 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 {
|
||||
lateinit var s: String
|
||||
s = "OK"
|
||||
return s
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
MODULE main
|
||||
CLASS LocalNotInitializedKt.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,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.
|
||||
*/
|
||||
// JVM_ABI_K1_K2_DIFF: KT-63864
|
||||
// WITH_STDLIB
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
val sb = StringBuilder()
|
||||
|
||||
fun box(): String {
|
||||
lateinit var s: String
|
||||
|
||||
try {
|
||||
sb.appendLine(s)
|
||||
}
|
||||
catch (e: RuntimeException) {
|
||||
sb.append("OK")
|
||||
return sb.toString()
|
||||
}
|
||||
return "Fail"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
MODULE main
|
||||
CLASS NotInitializedKt.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,28 @@
|
||||
/*
|
||||
* 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.*
|
||||
|
||||
class A {
|
||||
lateinit var s: String
|
||||
|
||||
fun foo() = s
|
||||
}
|
||||
|
||||
val sb = StringBuilder()
|
||||
|
||||
fun box(): String {
|
||||
val a = A()
|
||||
try {
|
||||
sb.appendLine(a.foo())
|
||||
}
|
||||
catch (e: RuntimeException) {
|
||||
sb.append("OK")
|
||||
return sb.toString()
|
||||
}
|
||||
return "Fail"
|
||||
}
|
||||
Reference in New Issue
Block a user