Skip to content

Commit 9261a6f

Browse files
SvyatoslavScherbinaSpace Team
authored andcommitted
[K/N][tests] Add a reproducer for KT-85508
This commit adds a test closely following the case reported in KT-85508. (cherry picked from commit 7607169)
1 parent c9ab9db commit 9261a6f

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

  • native/native.tests/testData/codegen/cinterop/objc
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// TARGET_BACKEND: NATIVE
2+
// WITH_PLATFORM_LIBS
3+
// DISABLE_NATIVE: isAppleTarget=false
4+
5+
// KT-85508
6+
// DISABLE_NATIVE: isAppleTarget=true
7+
@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class)
8+
9+
import platform.Network.NW_PARAMETERS_DISABLE_PROTOCOL
10+
import platform.Network.nw_parameters_copy
11+
import platform.Network.nw_parameters_create_secure_tcp
12+
import platform.Network.nw_tcp_options_set_enable_keepalive
13+
14+
fun box(): String {
15+
// See KT-85508.
16+
val params = nw_parameters_create_secure_tcp(
17+
NW_PARAMETERS_DISABLE_PROTOCOL
18+
) { tcpOptions ->
19+
nw_tcp_options_set_enable_keepalive(tcpOptions, true)
20+
}
21+
22+
val paramsCopy = nw_parameters_copy(params) // Just a use site.
23+
return if (paramsCopy != null) "OK" else "FAIL: $params"
24+
}

0 commit comments

Comments
 (0)