File tree 1 file changed +24
-1
lines changed 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change 5
5
6
6
package kotlinx.datetime.test
7
7
8
+ import kotlinx.cinterop.ByteVar
9
+ import kotlinx.cinterop.ExperimentalForeignApi
10
+ import kotlinx.cinterop.UnsafeNumber
11
+ import kotlinx.cinterop.allocArray
12
+ import kotlinx.cinterop.convert
13
+ import kotlinx.cinterop.memScoped
14
+ import kotlinx.cinterop.toKString
8
15
import kotlinx.datetime.TimeZone
9
16
import kotlinx.datetime.internal.root
10
17
import kotlin.test.Test
11
18
import kotlin.test.assertEquals
19
+ import platform.posix.*
12
20
13
21
class TimeZoneNativeTest {
14
22
23
+ @OptIn(ExperimentalForeignApi ::class , UnsafeNumber ::class )
24
+ private fun pwd (): String {
25
+ val PATH_MAX = 4096
26
+ return memScoped {
27
+ val buffer = allocArray<ByteVar >(PATH_MAX )
28
+ if (getcwd(buffer, PATH_MAX .convert()) != null ) {
29
+ buffer.toKString()
30
+ } else {
31
+ throw Exception (" Failed to get current directory: ${strerror(errno)?.toKString()} " )
32
+ }
33
+ }
34
+ }
35
+
15
36
@Test
16
37
fun correctSymlinkTest () {
17
38
root = " ./core/linux/test/time-zone-native-test-resources/correct-symlink/"
18
39
40
+ println (" PWD: ${pwd()} " )
41
+
19
42
val tz = TimeZone .currentSystemDefault()
20
- assertEquals(TimeZone .of(" Europe/Oslo" ), tz)
43
+ assertEquals(TimeZone .of(" Europe/Oslo" ), tz, " PWD: ${pwd()} " )
21
44
}
22
45
23
46
@Test
You can’t perform that action at this time.
0 commit comments