Skip to content

Commit f77c4d3

Browse files
committed
Use platform-specific newline (\r\n on Windows)
1 parent 4a79592 commit f77c4d3

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/auth/credentials/ExecuteCommandTest.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ import kotlin.test.assertFailsWith
1111
class ExecuteCommandTest {
1212
val provider = PlatformProvider.System
1313

14+
val PLATFORM_NEWLINE = when (provider.osInfo().family) {
15+
OsFamily.Windows -> "\r\n"
16+
else -> "\n"
17+
}
18+
1419
@Test
1520
fun testExecuteCommand() = runTest {
1621
val command = "echo Hello, World!"
@@ -23,7 +28,7 @@ class ExecuteCommandTest {
2328
)
2429

2530
assertEquals(0, result.first)
26-
assertEquals("Hello, World!\n", result.second)
31+
assertEquals("Hello, World!${PLATFORM_NEWLINE}", result.second)
2732
}
2833

2934
@Test
@@ -66,7 +71,7 @@ class ExecuteCommandTest {
6671
)
6772

6873
assertEquals(0, result.first)
69-
assertEquals(""""Hello, in quotes!"""" + "\n", result.second)
74+
assertEquals(""""Hello, in quotes!"$PLATFORM_NEWLINE""", result.second)
7075
}
7176

7277
@Test
@@ -102,6 +107,6 @@ class ExecuteCommandTest {
102107
)
103108

104109
assertEquals(13, result.first)
105-
assertEquals("Error message\n", result.second)
110+
assertEquals("Error message$PLATFORM_NEWLINE", result.second)
106111
}
107112
}

0 commit comments

Comments
 (0)