diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2023-09-02 11:53:56 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2023-10-17 18:14:53 +0200 |
commit | e34071131ec31b53c9dc4491f9eb2aa546a23ac7 (patch) | |
tree | 5d67e684f5d419026eb2c9b9697c1a706f45f893 /tests | |
parent | 9bc9df47d72af83313483c7324d3dcae9157f939 (diff) | |
download | weechat-e34071131ec31b53c9dc4491f9eb2aa546a23ac7.zip |
api: add function string_concat (issue #2005)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/core/test-core-string.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/unit/core/test-core-string.cpp b/tests/unit/core/test-core-string.cpp index 11a742161..ea4722e38 100644 --- a/tests/unit/core/test-core-string.cpp +++ b/tests/unit/core/test-core-string.cpp @@ -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)); +} |