Skip to content

Commit 930cda2

Browse files
mglukhikhSpace Team
authored andcommitted
Swift export: add execution test for KT-66838
1 parent 0aadb01 commit 930cda2

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// KIND: STANDALONE
2+
// FREE_COMPILER_ARGS: -opt-in=kotlin.native.internal.InternalForKotlinNative
3+
// MODULE: Vararg
4+
// FILE: Vararg.kt
5+
6+
fun simple(a: String, vararg b: Int): String = buildString {
7+
append(a)
8+
b.forEach { append(it) }
9+
}
10+
11+
class Accessor(vararg val x: Float) {
12+
operator fun get(i: Int): Float = x[i]
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import Vararg
2+
import KotlinRuntime
3+
import Testing
4+
5+
@Test
6+
func testVararg() throws {
7+
let x = simple(a: "a", b: 4, 5, 6)
8+
try #require(x == "a456")
9+
10+
let accessor = Accessor(x: 3.14, 2.72)
11+
try #require(accessor[0] > 3.1)
12+
try #require(accessor[1] < 2.8)
13+
}

native/swift/swift-export-standalone-integration-tests/simple/tests-gen/org/jetbrains/kotlin/swiftexport/standalone/test/SwiftExportExecutionTestGenerated.java

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)