summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2024-10-31 11:22:39 +0100
committerLennart Poettering <lennart@poettering.net>2024-10-31 11:38:18 +0100
commita39c51799b27531183e7393ea9c669f6148f257a (patch)
tree0ab6caa97c9221e7d7166cc66c1db7bd4bdf6ffa /src/test
parentterminal-util: define ANSI_OSC as macro for the OSC terminal sequence prefix (diff)
downloadsystemd-a39c51799b27531183e7393ea9c669f6148f257a.tar.xz
systemd-a39c51799b27531183e7393ea9c669f6148f257a.zip
string-util: also check for 0x1b 0x5c ST when stripping ANSI from strings
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-strip-tab-ansi.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/test/test-strip-tab-ansi.c b/src/test/test-strip-tab-ansi.c
index 3ad0fcd90e..00bd7cdaf1 100644
--- a/src/test/test-strip-tab-ansi.c
+++ b/src/test/test-strip-tab-ansi.c
@@ -67,6 +67,15 @@ TEST(strip_tab_ansi) {
assert_se(strip_tab_ansi(&q, NULL, NULL));
ASSERT_STREQ(q, qq);
}
+
+ /* Test that both kinds of ST are recognized after OSC */
+ assert_se(p = strdup("before" ANSI_OSC "inside1" ANSI_ST
+ "between1" ANSI_OSC "inside2\a"
+ "between2" ANSI_OSC "inside3\x1b\x5c"
+ "after"));
+ assert_se(strip_tab_ansi(&p, NULL, NULL));
+ ASSERT_STREQ(p, "beforebetween1between2after");
+ free(p);
}
DEFINE_TEST_MAIN(LOG_INFO);