diff options
author | Luca Boccassi <bluca@debian.org> | 2024-11-01 12:18:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-01 12:18:57 +0100 |
commit | d86e9b64e49314f633fe9114c5b84f82758c89ef (patch) | |
tree | 16be29a25737b28189d419fa35c69587cfdf8c32 /src/test | |
parent | Homed update policy: user changing own settings (#31153) (diff) | |
parent | string-util: also check for 0x1b 0x5c ST when stripping ANSI from strings (diff) | |
download | systemd-d86e9b64e49314f633fe9114c5b84f82758c89ef.tar.xz systemd-d86e9b64e49314f633fe9114c5b84f82758c89ef.zip |
tweaks to ANSI sequence (OSC) handling (#34964)
Fixes: #34604
Prompted by that I realized we do not correctly recognize both "ST"
sequences we want to recognize, fix that.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test-strip-tab-ansi.c | 9 |
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); |