mutt_buffer_strcpy(&buf, NULL);
TEST_CHECK_(1, "mutt_buffer_strcpy(&buf, NULL)");
}
+
+ TEST_CASE("Copy to an empty Buffer");
+
+ {
+ TEST_CASE("Empty");
+ struct Buffer *buf = mutt_buffer_new();
+ mutt_buffer_strcpy(buf, "");
+ TEST_CHECK(strcmp(mutt_b2s(buf), "") == 0);
+ mutt_buffer_free(&buf);
+ }
+
+ {
+ TEST_CASE("String");
+ const char *str = "test";
+ struct Buffer *buf = mutt_buffer_new();
+ mutt_buffer_strcpy(buf, str);
+ TEST_CHECK(strcmp(mutt_b2s(buf), str) == 0);
+ mutt_buffer_free(&buf);
+ }
+
+ TEST_CASE("Overwrite a non-empty Buffer");
+
+ {
+ TEST_CASE("Empty");
+ struct Buffer *buf = mutt_buffer_from("test");
+ mutt_buffer_strcpy(buf, "");
+ TEST_CHECK(strcmp(mutt_b2s(buf), "") == 0);
+ mutt_buffer_free(&buf);
+ }
+
+ {
+ TEST_CASE("String");
+ const char *str = "apple";
+ struct Buffer *buf = mutt_buffer_from("test");
+ mutt_buffer_strcpy(buf, str);
+ TEST_CHECK(strcmp(mutt_b2s(buf), str) == 0);
+ mutt_buffer_free(&buf);
+ }
}