Add more tests from the latest snapshot

This commit is contained in:
Pavel Punegov
2017-11-15 16:03:07 +03:00
committed by Pavel Punegov
parent d71af3da10
commit 4d8fddef6e
3 changed files with 37 additions and 1 deletions
@@ -0,0 +1,9 @@
//WITH_RUNTIME
fun foo(x: String, ys: List<String>) =
x + ys.fold("", { a, b -> a + b })
var flag = true
fun box(): String =
foo("O", if (flag) listOf("k").map { it.toUpperCase() } else listOf())
@@ -0,0 +1,27 @@
// FILE: 1.kt
//WITH_RUNTIME
package test
data class Address(
val createdTimeMs: Long = 0,
val firstName: String = "",
val lastName: String = ""
)
inline fun String.switchIfEmpty(provider: () -> String): String {
return if (isEmpty()) provider() else this
}
// FILE: 2.kt
import test.*
fun box(): String {
val address = Address()
val result = address.copy(
firstName = address.firstName.switchIfEmpty { "O" },
lastName = address.lastName.switchIfEmpty { "K" }
)
return result.firstName + result.lastName
}
+1 -1
View File
@@ -19,7 +19,7 @@ llvmVersion = 3.9.0
remoteRoot=konan_tests
#kotlinCompilerModule=org.jetbrains.kotlin:kotlin-compiler:1.1-SNAPSHOT
# Download artifacts of https://teamcity.jetbrains.com/viewType.html?buildTypeId=Kotlin_120_Compiler
testDataVersion=1213932:id
testDataVersion=1226829:id
kotlinCompilerRepo=https://dl.bintray.com/jetbrains/kotlin-native-dependencies
#kotlinCompilerRepo=http://oss.sonatype.org/content/repositories/snapshots
#kotlinCompilerRepo=http://dl.bintray.com/kotlin/kotlin-dev