[K/N][tests] Adjust moved tests to new testing infra
^KT-61259
This commit is contained in:
committed by
Space Team
parent
0a0da76a56
commit
e68bd1f04f
+10
-7
@@ -3,16 +3,16 @@
|
|||||||
* that can be found in the LICENSE file.
|
* that can be found in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package runtime.basic.statements0
|
|
||||||
|
|
||||||
import kotlin.test.*
|
import kotlin.test.*
|
||||||
|
|
||||||
|
val sb = StringBuilder()
|
||||||
|
|
||||||
fun simple() {
|
fun simple() {
|
||||||
var a = 238
|
var a = 238
|
||||||
a++
|
a++
|
||||||
println(a)
|
sb.appendLine(a)
|
||||||
--a
|
--a
|
||||||
println(a)
|
sb.appendLine(a)
|
||||||
}
|
}
|
||||||
|
|
||||||
class Foo() {
|
class Foo() {
|
||||||
@@ -31,12 +31,15 @@ class Foo() {
|
|||||||
fun fields() {
|
fun fields() {
|
||||||
val foo = Foo()
|
val foo = Foo()
|
||||||
foo.more()
|
foo.more()
|
||||||
println(foo.i)
|
sb.appendLine(foo.i)
|
||||||
foo.less()
|
foo.less()
|
||||||
println(foo.i)
|
sb.appendLine(foo.i)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun runTest() {
|
fun box(): String {
|
||||||
simple()
|
simple()
|
||||||
fields()
|
fields()
|
||||||
|
|
||||||
|
assertEquals("239\n238\n30\n29\n", sb.toString())
|
||||||
|
return "OK"
|
||||||
}
|
}
|
||||||
+11
-7
@@ -2,8 +2,7 @@
|
|||||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
* 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.
|
* that can be found in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
// !LANGUAGE: -ProhibitComparisonOfIncompatibleEnums
|
||||||
package runtime.basic.enum_equals
|
|
||||||
|
|
||||||
import kotlin.test.*
|
import kotlin.test.*
|
||||||
|
|
||||||
@@ -15,8 +14,13 @@ enum class EnumB {
|
|||||||
B
|
B
|
||||||
}
|
}
|
||||||
|
|
||||||
fun main() {
|
fun box(): String {
|
||||||
println(EnumA.A == EnumA.A)
|
if (!(EnumA.A == EnumA.A))
|
||||||
println(EnumA.A == EnumA.B)
|
return "FAIL: A must equal A"
|
||||||
println(EnumA.A == EnumB.B)
|
if (EnumA.A == EnumA.B)
|
||||||
}
|
return "FAIL: A.A must not equal A.B"
|
||||||
|
if (EnumA.A == EnumB.B)
|
||||||
|
return "FAIL: A.A must not equal B.B"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
|
|||||||
+16
-8
@@ -3,23 +3,31 @@
|
|||||||
* that can be found in the LICENSE file.
|
* that can be found in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package runtime.exceptions.catch1
|
|
||||||
|
|
||||||
import kotlin.test.*
|
import kotlin.test.*
|
||||||
|
|
||||||
@Test fun runTest() {
|
val sb = StringBuilder()
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
try {
|
try {
|
||||||
println("Before")
|
sb.appendLine("Before")
|
||||||
foo()
|
foo()
|
||||||
println("After")
|
sb.appendLine("After")
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
println("Caught Throwable")
|
sb.appendLine("Caught Throwable")
|
||||||
}
|
}
|
||||||
|
|
||||||
println("Done")
|
sb.appendLine("Done")
|
||||||
|
|
||||||
|
assertEquals("""
|
||||||
|
Before
|
||||||
|
Caught Throwable
|
||||||
|
Done
|
||||||
|
|
||||||
|
""".trimIndent(), sb.toString())
|
||||||
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
throw Error("Error happens")
|
throw Error("Error happens")
|
||||||
println("After in foo()")
|
sb.appendLine("After in foo()")
|
||||||
}
|
}
|
||||||
+18
-10
@@ -3,27 +3,35 @@
|
|||||||
* that can be found in the LICENSE file.
|
* that can be found in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package runtime.exceptions.catch2
|
|
||||||
|
|
||||||
import kotlin.test.*
|
import kotlin.test.*
|
||||||
|
|
||||||
@Test fun runTest() {
|
val sb = StringBuilder()
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
try {
|
try {
|
||||||
println("Before")
|
sb.appendLine("Before")
|
||||||
foo()
|
foo()
|
||||||
println("After")
|
sb.appendLine("After")
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
println("Caught Exception")
|
sb.appendLine("Caught Exception")
|
||||||
} catch (e: Error) {
|
} catch (e: Error) {
|
||||||
println("Caught Error")
|
sb.appendLine("Caught Error")
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
println("Caught Throwable")
|
sb.appendLine("Caught Throwable")
|
||||||
}
|
}
|
||||||
|
|
||||||
println("Done")
|
sb.appendLine("Done")
|
||||||
|
|
||||||
|
assertEquals("""
|
||||||
|
Before
|
||||||
|
Caught Error
|
||||||
|
Done
|
||||||
|
|
||||||
|
""".trimIndent(), sb.toString())
|
||||||
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
throw Error("Error happens")
|
throw Error("Error happens")
|
||||||
println("After in foo()")
|
sb.appendLine("After in foo()")
|
||||||
}
|
}
|
||||||
@@ -3,21 +3,23 @@
|
|||||||
* that can be found in the LICENSE file.
|
* that can be found in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package runtime.exceptions.catch7
|
|
||||||
|
|
||||||
import kotlin.test.*
|
import kotlin.test.*
|
||||||
|
|
||||||
@Test fun runTest() {
|
val sb = StringBuilder()
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
try {
|
try {
|
||||||
foo()
|
foo()
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
val message = e.message
|
val message = e.message
|
||||||
if (message != null) {
|
if (message != null) {
|
||||||
println(message)
|
sb.append(message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return sb.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
throw Error("Error happens")
|
throw Error("OK")
|
||||||
}
|
}
|
||||||
@@ -3,16 +3,15 @@
|
|||||||
* that can be found in the LICENSE file.
|
* that can be found in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package runtime.exceptions.extend0
|
|
||||||
|
|
||||||
import kotlin.test.*
|
import kotlin.test.*
|
||||||
|
|
||||||
class C : Exception("OK")
|
class C : Exception("OK")
|
||||||
|
|
||||||
@Test fun runTest() {
|
fun box(): String {
|
||||||
try {
|
try {
|
||||||
throw C()
|
throw C()
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
println(e.message!!)
|
return e.message!!
|
||||||
}
|
}
|
||||||
|
return "FAIL"
|
||||||
}
|
}
|
||||||
@@ -3,12 +3,9 @@
|
|||||||
* that can be found in the LICENSE file.
|
* that can be found in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package runtime.exceptions.rethtow
|
|
||||||
|
|
||||||
import kotlin.test.*
|
import kotlin.test.*
|
||||||
|
|
||||||
@Test
|
fun box(): String {
|
||||||
fun runTest() {
|
|
||||||
assertFailsWith<IllegalStateException>("My error") {
|
assertFailsWith<IllegalStateException>("My error") {
|
||||||
try {
|
try {
|
||||||
error("My error")
|
error("My error")
|
||||||
@@ -16,4 +13,5 @@ fun runTest() {
|
|||||||
throw e
|
throw e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,15 +3,13 @@
|
|||||||
* that can be found in the LICENSE file.
|
* that can be found in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package runtime.basic.throw0
|
|
||||||
|
|
||||||
import kotlin.test.*
|
import kotlin.test.*
|
||||||
|
|
||||||
@Test fun runTest() {
|
fun box(): String {
|
||||||
val cond = 1
|
val cond = 1
|
||||||
if (cond == 2) throw RuntimeException()
|
if (cond == 2) throw RuntimeException()
|
||||||
if (cond == 3) throw NoSuchElementException("no such element")
|
if (cond == 3) throw NoSuchElementException("no such element")
|
||||||
if (cond == 4) throw Error("error happens")
|
if (cond == 4) throw Error("error happens")
|
||||||
|
|
||||||
println("Done")
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,9 @@
|
|||||||
* that can be found in the LICENSE file.
|
* that can be found in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package runtime.exceptions.throw_from_catch
|
|
||||||
|
|
||||||
import kotlin.test.*
|
import kotlin.test.*
|
||||||
|
|
||||||
@Test
|
fun box(): String {
|
||||||
fun runTest() {
|
|
||||||
assertFailsWith<IllegalStateException>("My another error") {
|
assertFailsWith<IllegalStateException>("My another error") {
|
||||||
try {
|
try {
|
||||||
error("My error")
|
error("My error")
|
||||||
@@ -16,4 +13,5 @@ fun runTest() {
|
|||||||
error("My another error")
|
error("My another error")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,51 +3,66 @@
|
|||||||
* that can be found in the LICENSE file.
|
* that can be found in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package runtime.basic.initializers0
|
|
||||||
|
|
||||||
import kotlin.test.*
|
import kotlin.test.*
|
||||||
|
|
||||||
|
val sb = StringBuilder()
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
init{
|
init{
|
||||||
println ("A::init")
|
sb.appendLine ("A::init")
|
||||||
}
|
}
|
||||||
|
|
||||||
val a = 1
|
val a = 1
|
||||||
|
|
||||||
companion object :B(1) {
|
companion object :B(1) {
|
||||||
init {
|
init {
|
||||||
println ("A::companion")
|
sb.appendLine ("A::companion")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
println("A::companion::foo")
|
sb.appendLine("A::companion::foo")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object AObj : B(){
|
object AObj : B(){
|
||||||
init {
|
init {
|
||||||
println("A::Obj")
|
sb.appendLine("A::Obj")
|
||||||
}
|
}
|
||||||
fun foo() {
|
fun foo() {
|
||||||
println("A::AObj::foo")
|
sb.appendLine("A::AObj::foo")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun runTest() {
|
fun box(): String {
|
||||||
println("main")
|
sb.appendLine("main")
|
||||||
A.foo()
|
A.foo()
|
||||||
A.foo()
|
A.foo()
|
||||||
A.AObj.foo()
|
A.AObj.foo()
|
||||||
A.AObj.foo()
|
A.AObj.foo()
|
||||||
|
|
||||||
|
assertEquals("""
|
||||||
|
main
|
||||||
|
B::constructor(1)
|
||||||
|
A::companion
|
||||||
|
A::companion::foo
|
||||||
|
A::companion::foo
|
||||||
|
B::constructor(0)
|
||||||
|
B::constructor()
|
||||||
|
A::Obj
|
||||||
|
A::AObj::foo
|
||||||
|
A::AObj::foo
|
||||||
|
|
||||||
|
""".trimIndent(), sb.toString())
|
||||||
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|
||||||
open class B(val a:Int, val b:Int) {
|
open class B(val a:Int, val b:Int) {
|
||||||
constructor(a:Int):this (a, 0) {
|
constructor(a:Int):this (a, 0) {
|
||||||
println("B::constructor(" + a.toString()+ ")")
|
sb.appendLine("B::constructor(" + a.toString()+ ")")
|
||||||
}
|
}
|
||||||
constructor():this(0) {
|
constructor():this(0) {
|
||||||
println("B::constructor()")
|
sb.appendLine("B::constructor()")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,21 +2,21 @@
|
|||||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
* 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.
|
* that can be found in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package runtime.basic.initializers1
|
|
||||||
|
|
||||||
import kotlin.test.*
|
import kotlin.test.*
|
||||||
|
|
||||||
|
val sb = StringBuilder()
|
||||||
|
|
||||||
class TestClass {
|
class TestClass {
|
||||||
companion object {
|
companion object {
|
||||||
init {
|
init {
|
||||||
println("Init Test")
|
sb.append("OK")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun runTest() {
|
fun box(): String {
|
||||||
val t1 = TestClass()
|
val t1 = TestClass()
|
||||||
val t2 = TestClass()
|
val t2 = TestClass()
|
||||||
println("Done")
|
|
||||||
|
return sb.toString()
|
||||||
}
|
}
|
||||||
@@ -3,9 +3,13 @@
|
|||||||
* that can be found in the LICENSE file.
|
* that can be found in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import kotlin.test.*
|
||||||
|
|
||||||
|
val sb = StringBuilder()
|
||||||
|
|
||||||
class A(val msg: String) {
|
class A(val msg: String) {
|
||||||
init {
|
init {
|
||||||
println("init $msg")
|
sb.appendLine("init $msg")
|
||||||
}
|
}
|
||||||
override fun toString(): String = msg
|
override fun toString(): String = msg
|
||||||
}
|
}
|
||||||
@@ -14,9 +18,19 @@ val globalValue1 = 1
|
|||||||
val globalValue2 = A("globalValue2")
|
val globalValue2 = A("globalValue2")
|
||||||
val globalValue3 = A("globalValue3")
|
val globalValue3 = A("globalValue3")
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun box(): String {
|
||||||
println(globalValue1.toString())
|
sb.appendLine(globalValue1.toString())
|
||||||
println(globalValue2.toString())
|
sb.appendLine(globalValue2.toString())
|
||||||
println(globalValue3.toString())
|
sb.appendLine(globalValue3.toString())
|
||||||
|
|
||||||
|
assertEquals("""
|
||||||
|
init globalValue2
|
||||||
|
init globalValue3
|
||||||
|
1
|
||||||
|
globalValue2
|
||||||
|
globalValue3
|
||||||
|
|
||||||
|
""".trimIndent(), sb.toString())
|
||||||
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,15 +2,13 @@
|
|||||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
* 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.
|
* that can be found in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package runtime.basic.initializers3
|
|
||||||
|
|
||||||
import kotlin.test.*
|
import kotlin.test.*
|
||||||
|
|
||||||
class Foo(val bar: Int)
|
class Foo(val bar: Int)
|
||||||
|
|
||||||
var x = Foo(42)
|
var x = Foo(42)
|
||||||
|
|
||||||
@Test fun runTest() {
|
fun box(): String {
|
||||||
println(x.bar)
|
assertEquals(42, x.bar)
|
||||||
|
return "OK"
|
||||||
}
|
}
|
||||||
@@ -2,15 +2,14 @@
|
|||||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
* 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.
|
* that can be found in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package runtime.basic.initializers4
|
|
||||||
|
|
||||||
import kotlin.test.*
|
import kotlin.test.*
|
||||||
|
|
||||||
const val INT_MAX_POWER_OF_TWO: Int = Int.MAX_VALUE / 2 + 1
|
const val INT_MAX_POWER_OF_TWO: Int = Int.MAX_VALUE / 2 + 1
|
||||||
val DOUBLE = Double.MAX_VALUE - 1.0
|
val DOUBLE = Double.MAX_VALUE - 1.0
|
||||||
|
|
||||||
@Test fun runTest() {
|
fun box(): String {
|
||||||
println(INT_MAX_POWER_OF_TWO)
|
assertEquals(1073741824, INT_MAX_POWER_OF_TWO)
|
||||||
println(DOUBLE > 0.0)
|
assertTrue(DOUBLE > 0.0)
|
||||||
|
|
||||||
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
* 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.
|
* that can be found in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package runtime.basic.initializers5
|
|
||||||
|
|
||||||
import kotlin.test.*
|
import kotlin.test.*
|
||||||
|
|
||||||
object A {
|
object A {
|
||||||
@@ -12,6 +9,8 @@ object A {
|
|||||||
val b = A.a
|
val b = A.a
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun runTest() {
|
fun box(): String {
|
||||||
println(A.b)
|
assertEquals(42, A.b)
|
||||||
|
|
||||||
|
return "OK"
|
||||||
}
|
}
|
||||||
@@ -2,9 +2,6 @@
|
|||||||
* Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
* Copyright 2010-2020 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.
|
* that can be found in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package runtime.basic.initializers7
|
|
||||||
|
|
||||||
import kotlin.test.*
|
import kotlin.test.*
|
||||||
|
|
||||||
object A {
|
object A {
|
||||||
@@ -53,8 +50,10 @@ fun assertCUninitialized() {
|
|||||||
assertEquals(0, C.c4)
|
assertEquals(0, C.c4)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun runTest() {
|
fun box(): String {
|
||||||
assertEquals(A.a1, C.c2)
|
assertEquals(A.a1, C.c2)
|
||||||
assertEquals(A.a2, C.c3)
|
assertEquals(A.a2, C.c3)
|
||||||
assertEquals(C.c1, C.c4)
|
assertEquals(C.c1, C.c4)
|
||||||
|
|
||||||
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,10 @@
|
|||||||
* Copyright 2010-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
* Copyright 2010-2021 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.
|
* that can be found in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package runtime.basic.initializers8
|
|
||||||
|
|
||||||
import kotlin.test.*
|
import kotlin.test.*
|
||||||
|
|
||||||
var globalString = "abc"
|
var globalString = "OK"
|
||||||
|
|
||||||
@Test fun runTest() {
|
fun box(): String {
|
||||||
assertEquals("abc", globalString)
|
return globalString
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
* 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.
|
* that can be found in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package runtime.basic.interface0
|
|
||||||
|
|
||||||
import kotlin.test.*
|
import kotlin.test.*
|
||||||
|
|
||||||
interface A {
|
interface A {
|
||||||
@@ -12,14 +9,17 @@ interface A {
|
|||||||
fun c()
|
fun c()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val sb = StringBuilder()
|
||||||
|
|
||||||
class B(): A {
|
class B(): A {
|
||||||
override fun c() {
|
override fun c() {
|
||||||
println("PASSED")
|
sb.append("OK")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun runTest() {
|
fun box(): String {
|
||||||
val a:A = B()
|
val a:A = B()
|
||||||
a.b()
|
a.b()
|
||||||
}
|
|
||||||
|
|
||||||
|
return sb.toString()
|
||||||
|
}
|
||||||
|
|||||||
+12
-6
@@ -2,17 +2,23 @@
|
|||||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
* 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.
|
* that can be found in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
// WITH_STDLIB
|
||||||
package datagen.literals.listof1
|
// This test verifies absence of buggy optimzation removed in https://github.com/JetBrains/kotlin/commit/d222e9587
|
||||||
|
|
||||||
import kotlin.test.*
|
import kotlin.test.*
|
||||||
|
|
||||||
@Test fun runTest() {
|
fun box(): String {
|
||||||
val list = foo()
|
val list = foo()
|
||||||
println(list === foo())
|
if (!(list == foo()))
|
||||||
println(list.toString())
|
return "FAIL =="
|
||||||
|
if (list === foo())
|
||||||
|
return "FAIL ===: two listOf() having same contents are not optimized to be referentially equal in all backends, but are now unexpectedly referentially equal"
|
||||||
|
if (list.toString() != "[a, b, c]")
|
||||||
|
return "FAIL toString(): ${list.toString()}"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|
||||||
fun foo(): List<String> {
|
fun foo(): List<String> {
|
||||||
return listOf("a", "b", "c")
|
return listOf("a", "b", "c")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,13 +3,15 @@
|
|||||||
* that can be found in the LICENSE file.
|
* that can be found in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package datagen.literals.strdedup1
|
|
||||||
|
|
||||||
import kotlin.test.*
|
import kotlin.test.*
|
||||||
|
|
||||||
@Test fun runTest() {
|
fun box(): String {
|
||||||
val str1 = "Hello"
|
val str1 = "Hello"
|
||||||
val str2 = "Hello"
|
val str2 = "Hello"
|
||||||
println(str1 == str2)
|
if (!(str1 == str2))
|
||||||
println(str1 === str2)
|
return "FAIL =="
|
||||||
|
if (!(str1 === str2))
|
||||||
|
return "FAIL ==="
|
||||||
|
|
||||||
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-5
@@ -2,14 +2,20 @@
|
|||||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
* 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.
|
* that can be found in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
// TODO: string deduplication across several components seems to require
|
||||||
package datagen.literals.strdedup2
|
// linking them as bitcode modules before translating to machine code.
|
||||||
|
// IGNORE_BACKEND: NATIVE, JVM, JVM_IR
|
||||||
|
// WITH_STDLIB
|
||||||
|
|
||||||
import kotlin.test.*
|
import kotlin.test.*
|
||||||
|
|
||||||
@Test fun runTest() {
|
fun box(): String {
|
||||||
val str1 = ""
|
val str1 = ""
|
||||||
val str2 = "hello".subSequence(2, 2)
|
val str2 = "hello".subSequence(2, 2)
|
||||||
println(str1 == str2)
|
if(!(str1 == str2))
|
||||||
println(str1 === str2)
|
return "FAIL =="
|
||||||
|
if(!(str1 === str2))
|
||||||
|
return "FAIL ==="
|
||||||
|
|
||||||
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,11 @@
|
|||||||
// As soon the issue would be fixed, please remove `&& cacheMode=NO` from next line.
|
// As soon the issue would be fixed, please remove `&& cacheMode=NO` from next line.
|
||||||
// IGNORE_NATIVE: gcType=NOOP && cacheMode=NO
|
// IGNORE_NATIVE: gcType=NOOP && cacheMode=NO
|
||||||
|
|
||||||
|
// Ideally, this test must fail with gcType=NOOP with any cache mode.
|
||||||
|
// KT-63944: unfortunately, GC flavours are silently not switched in presence of caches.
|
||||||
|
// As soon the issue would be fixed, please remove `&& cacheMode=NO` from next line.
|
||||||
|
// IGNORE_NATIVE: gcType=NOOP && cacheMode=NO
|
||||||
|
|
||||||
import kotlin.native.internal.*
|
import kotlin.native.internal.*
|
||||||
import kotlin.test.*
|
import kotlin.test.*
|
||||||
|
|
||||||
|
|||||||
+2
@@ -927,6 +927,7 @@ private fun Settings.isIgnoredWithIGNORE_BACKEND(directives: Directives): Boolea
|
|||||||
private val CACHE_MODE_NAMES = CacheMode.Alias.entries.map { it.name }
|
private val CACHE_MODE_NAMES = CacheMode.Alias.entries.map { it.name }
|
||||||
private val TEST_MODE_NAMES = TestMode.entries.map { it.name }
|
private val TEST_MODE_NAMES = TestMode.entries.map { it.name }
|
||||||
private val OPTIMIZATION_MODE_NAMES = OptimizationMode.entries.map { it.name }
|
private val OPTIMIZATION_MODE_NAMES = OptimizationMode.entries.map { it.name }
|
||||||
|
private val GC_TYPE_NAMES = GCType.entries.map { it.name }
|
||||||
|
|
||||||
private fun Settings.isIgnoredWithIGNORE_NATIVE(
|
private fun Settings.isIgnoredWithIGNORE_NATIVE(
|
||||||
directives: Directives,
|
directives: Directives,
|
||||||
@@ -951,6 +952,7 @@ private fun Settings.isIgnoredWithIGNORE_NATIVE(
|
|||||||
ClassLevelProperty.TEST_MODE.shortName -> get<TestMode>().name to TEST_MODE_NAMES
|
ClassLevelProperty.TEST_MODE.shortName -> get<TestMode>().name to TEST_MODE_NAMES
|
||||||
ClassLevelProperty.OPTIMIZATION_MODE.shortName -> get<OptimizationMode>().name to OPTIMIZATION_MODE_NAMES
|
ClassLevelProperty.OPTIMIZATION_MODE.shortName -> get<OptimizationMode>().name to OPTIMIZATION_MODE_NAMES
|
||||||
ClassLevelProperty.TEST_TARGET.shortName -> get<KotlinNativeTargets>().testTarget.name to null
|
ClassLevelProperty.TEST_TARGET.shortName -> get<KotlinNativeTargets>().testTarget.name to null
|
||||||
|
ClassLevelProperty.GC_TYPE.shortName -> get<GCType>().name to GC_TYPE_NAMES
|
||||||
else -> throw AssertionError("ClassLevelProperty name: $propName is not yet supported in IGNORE_NATIVE* test directives.")
|
else -> throw AssertionError("ClassLevelProperty name: $propName is not yet supported in IGNORE_NATIVE* test directives.")
|
||||||
}
|
}
|
||||||
val valueFromTestDirective = matchResult.groups[2]?.value!!
|
val valueFromTestDirective = matchResult.groups[2]?.value!!
|
||||||
|
|||||||
Reference in New Issue
Block a user