From fc625a81245ed97e48c32f80470dae768f567718 Mon Sep 17 00:00:00 2001 From: az Date: Mon, 29 Nov 2021 14:17:57 +0100 Subject: [PATCH] [skip ci] add test escaping raw String --- .../provs/ubuntu/utils/UtilsKtTest.kt | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/test/kotlin/org/domaindrivenarchitecture/provs/ubuntu/utils/UtilsKtTest.kt b/src/test/kotlin/org/domaindrivenarchitecture/provs/ubuntu/utils/UtilsKtTest.kt index 89e87cf..ef4dc47 100644 --- a/src/test/kotlin/org/domaindrivenarchitecture/provs/ubuntu/utils/UtilsKtTest.kt +++ b/src/test/kotlin/org/domaindrivenarchitecture/provs/ubuntu/utils/UtilsKtTest.kt @@ -10,15 +10,35 @@ internal class UtilsKtTest { @ContainerTest @Test - fun printToShell_escapes_successfully() { + fun printToShell_escapes_String_successfully() { // given val a = Prov.defaultInstance() // when - val testString = "test if newline \n and apostrophe's ' \" and special chars !§$%[]\\ äöüß \$variable are handled correctly" + val testString = "test if newline \n and apostrophe's ' \" and special chars $ !§$%[]\\ äöüß \$variable and tabs \t are handled correctly" + val res = a.cmd(echoCommandForText(testString)).out // then assertEquals(testString, res) } + + @ContainerTest + @Test + fun printToShell_escapes_raw_String_successfully() { + // given + val a = Prov.defaultInstance() + + // when + val testMultiLineString = """ + test if newlines + \n + and apostrophe's ' " \" \' and special chars $ {} $\{something}!§$%[]\\ äöüß $\notakotlinvariable ${'$'}notakotlinvariable and tabs \t are handled correctly + """ + + val resMl = a.cmd(echoCommandForText(testMultiLineString)).out + + // then + assertEquals(testMultiLineString, resMl) + } } \ No newline at end of file