* @param buf Buffer containing source string
* @param buflen Length of buffer
* @param s String to add
- * @retval ptr Start of joined string
+ * @retval ptr Start of the buffer
*/
char *mutt_str_strcat(char *buf, size_t buflen, const char *s)
{
TEST_CHECK(mutt_str_strcat(NULL, 10, "apple") == NULL);
}
+ {
+ char buf[64] = { 0 };
+ TEST_CHECK(mutt_str_strcat(buf, 0, "apple") == buf);
+ TEST_CHECK(strcmp(buf, "") == 0);
+ }
+
{
char buf[32] = { 0 };
TEST_CHECK(mutt_str_strcat(buf, sizeof(buf), NULL) == buf);
}
+
+ {
+ char buf[32] = { 0 };
+ TEST_CHECK(mutt_str_strcat(buf, sizeof(buf), "") == buf);
+ TEST_CHECK(strcmp(buf, "") == 0);
+ }
+
+ {
+ char buf[32] = { 0 };
+ TEST_CHECK(mutt_str_strcat(buf, sizeof(buf), "banana") == buf);
+ TEST_CHECK(strcmp(buf, "banana") == 0);
+ }
+
+ {
+ char buf[32] = "apple";
+ TEST_CHECK(mutt_str_strcat(buf, sizeof(buf), "") == buf);
+ TEST_CHECK(strcmp(buf, "apple") == 0);
+ }
+
+ {
+ char buf[32] = "apple";
+ TEST_CHECK(mutt_str_strcat(buf, sizeof(buf), "banana") == buf);
+ TEST_CHECK(strcmp(buf, "applebanana") == 0);
+ }
}