some polish on strings

This commit is contained in:
Dustin J. Mitchell 2022-01-25 23:29:52 +00:00
parent ca0279a73f
commit 0d68e65354
8 changed files with 100 additions and 29 deletions

View file

@ -13,7 +13,7 @@ static void test_replica_creation(void) {
// creating an on-disk replica does not crash
static void test_replica_creation_disk(void) {
TCReplica *rep = tc_replica_new_on_disk(tc_string_new("test-db"), NULL);
TCReplica *rep = tc_replica_new_on_disk(tc_string_borrow("test-db"), NULL);
TEST_ASSERT_NOT_NULL(rep);
TEST_ASSERT_NULL(tc_replica_error(rep));
tc_replica_free(rep);
@ -24,7 +24,7 @@ static void test_replica_undo_empty(void) {
TCReplica *rep = tc_replica_new_in_memory();
TEST_ASSERT_NULL(tc_replica_error(rep));
int rv = tc_replica_undo(rep);
TEST_ASSERT_EQUAL(0, rv);
TEST_ASSERT_EQUAL(TC_RESULT_FALSE, rv);
TEST_ASSERT_NULL(tc_replica_error(rep));
tc_replica_free(rep);
}

View file

@ -5,7 +5,7 @@
// creating strings does not crash
static void test_string_creation(void) {
TCString *s = tc_string_new("abcdef");
TCString *s = tc_string_borrow("abcdef");
tc_string_free(s);
}
@ -22,7 +22,7 @@ static void test_string_cloning(void) {
// borrowed strings echo back their content
static void test_string_borrowed_strings_echo(void) {
TCString *s = tc_string_new("abcdef");
TCString *s = tc_string_borrow("abcdef");
TEST_ASSERT_NOT_NULL(s);
TEST_ASSERT_EQUAL_STRING("abcdef", tc_string_content(s));

View file

@ -11,7 +11,7 @@ static void test_task_creation(void) {
TCTask *task = tc_replica_new_task(
rep,
TC_STATUS_PENDING,
tc_string_new("my task"));
tc_string_borrow("my task"));
TEST_ASSERT_NOT_NULL(task);
TEST_ASSERT_EQUAL(TC_STATUS_PENDING, tc_task_get_status(task));