string-util: introduce strprepend_with_separator()
This commit is contained in:
@@ -1355,7 +1355,16 @@ TEST(strprepend) {
|
||||
|
||||
ASSERT_STREQ(strprepend(&x, "xxx"), "xxx");
|
||||
ASSERT_STREQ(strprepend(&x, "bar"), "barxxx");
|
||||
ASSERT_STREQ(strprepend(&x, "foo"), "foobarxxx");
|
||||
ASSERT_STREQ(strprepend(&x, "foo", "4711"), "foo4711barxxx");
|
||||
x = mfree(x);
|
||||
|
||||
ASSERT_STREQ(strprepend_with_separator(&x, "...", NULL), "");
|
||||
|
||||
ASSERT_STREQ(strprepend_with_separator(&x, "xyz", "a", "bb", "ccc"), "axyzbbxyzccc");
|
||||
x = mfree(x);
|
||||
|
||||
ASSERT_STREQ(strprepend_with_separator(&x, ",", "start", "", "1", "234"), "start,,1,234");
|
||||
ASSERT_STREQ(strprepend_with_separator(&x, ";", "more", "5", "678"), "more;5;678;start,,1,234");
|
||||
}
|
||||
|
||||
TEST(strlevenshtein) {
|
||||
|
||||
Reference in New Issue
Block a user