|
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 |
15 | 8 | import kotlinx.datetime.IllegalTimeZoneException
|
16 | 9 | import kotlinx.datetime.TimeZone
|
17 | 10 | import kotlinx.datetime.internal.root
|
18 | 11 | import kotlin.test.Test
|
19 | 12 | import kotlin.test.assertEquals
|
20 |
| -import platform.posix.* |
21 | 13 | import kotlin.test.assertFailsWith
|
22 | 14 | import kotlin.test.assertTrue
|
23 | 15 |
|
24 | 16 | class TimeZoneNativeTest {
|
25 | 17 |
|
26 |
| - @OptIn(ExperimentalForeignApi::class, UnsafeNumber::class) |
27 |
| - private fun pwd(): String { |
28 |
| - val PATH_MAX = 4096 |
29 |
| - return memScoped { |
30 |
| - val buffer = allocArray<ByteVar>(PATH_MAX) |
31 |
| - if (getcwd(buffer, PATH_MAX.convert()) != null) { |
32 |
| - buffer.toKString() |
33 |
| - } else { |
34 |
| - throw Exception("Failed to get current directory: ${strerror(errno)?.toKString()}") |
35 |
| - } |
36 |
| - } |
37 |
| - } |
38 |
| - |
39 | 18 | @Test
|
40 | 19 | fun correctSymlinkTest() {
|
41 | 20 | root = "${RESOURCES}correct-symlink/"
|
42 | 21 |
|
43 |
| - println("PWD: ${pwd()}") |
44 |
| - |
45 | 22 | val tz = TimeZone.currentSystemDefault()
|
46 |
| - assertEquals(TimeZone.of("Europe/Oslo"), tz, "PWD: ${pwd()}") |
| 23 | + assertEquals(TimeZone.of("Europe/Oslo"), tz) |
47 | 24 | }
|
48 | 25 |
|
49 | 26 | @Test
|
|
0 commit comments