1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-02 07:46:38 +02:00

api: add function string_concat (issue #2005)

This commit is contained in:
Sébastien Helleu
2023-09-02 11:53:56 +02:00
parent 9bc9df47d7
commit e34071131e
12 changed files with 334 additions and 2 deletions
+29
View File
@@ -2969,3 +2969,32 @@ TEST(CoreString, Dyn)
string_dyn_free (NULL, 0);
string_dyn_free (str, 0);
}
/*
* Tests functions:
* string_concat
*/
TEST(CoreString, Concat)
{
STRCMP_EQUAL("", string_concat (NULL, NULL));
STRCMP_EQUAL("", string_concat (NULL, "", NULL));
STRCMP_EQUAL("", string_concat ("", "", NULL));
STRCMP_EQUAL("", string_concat (",", "", NULL));
STRCMP_EQUAL("abc", string_concat (NULL, "abc", NULL));
STRCMP_EQUAL("abcdef", string_concat (NULL, "abc", "def", NULL));
STRCMP_EQUAL("abcdefghi", string_concat (NULL, "abc", "def", "ghi", NULL));
STRCMP_EQUAL("abc", string_concat ("", "abc", NULL));
STRCMP_EQUAL("abcdef", string_concat ("", "abc", "def", NULL));
STRCMP_EQUAL("abcdefghi", string_concat ("", "abc", "def", "ghi", NULL));
STRCMP_EQUAL("abc", string_concat (",", "abc", NULL));
STRCMP_EQUAL("abc,def", string_concat (",", "abc", "def", NULL));
STRCMP_EQUAL("abc,def,ghi", string_concat (",", "abc", "def", "ghi", NULL));
STRCMP_EQUAL("abc", string_concat (" / ", "abc", NULL));
STRCMP_EQUAL("abc / def", string_concat (" / ", "abc", "def", NULL));
STRCMP_EQUAL("abc / def / ghi", string_concat (" / ", "abc", "def", "ghi", NULL));
}