aboutsummaryrefslogtreecommitdiffstats
path: root/tests/common
diff options
context:
space:
mode:
Diffstat (limited to 'tests/common')
-rw-r--r--tests/common/check_error.c7
-rw-r--r--tests/common/check_utils.c4
2 files changed, 10 insertions, 1 deletions
diff --git a/tests/common/check_error.c b/tests/common/check_error.c
index d9806f9..1b6f855 100644
--- a/tests/common/check_error.c
+++ b/tests/common/check_error.c
@@ -28,7 +28,12 @@ test_error_new(void **state)
static void
test_error_new_printf(void **state)
{
- bc_error_t *error = bc_error_new_printf(2, "bola %s", "guda");
+ bc_error_t *error = bc_error_new_printf(2, NULL);
+ assert_non_null(error);
+ assert_int_equal(error->type, 2);
+ assert_string_equal(error->msg, "");
+ bc_error_free(error);
+ error = bc_error_new_printf(2, "bola %s", "guda");
assert_non_null(error);
assert_int_equal(error->type, 2);
assert_string_equal(error->msg, "bola guda");
diff --git a/tests/common/check_utils.c b/tests/common/check_utils.c
index cc14f4e..471cd77 100644
--- a/tests/common/check_utils.c
+++ b/tests/common/check_utils.c
@@ -117,6 +117,7 @@ test_strndup(void **state)
static void
test_strdup_printf(void **state)
{
+ assert_null(bc_strdup_printf(NULL));
char *str = bc_strdup_printf("bola");
assert_string_equal(str, "bola");
free(str);
@@ -554,6 +555,9 @@ static void
test_string_append_printf(void **state)
{
bc_string_t *str = bc_string_new();
+ str = bc_string_append_printf(str, NULL);
+ assert_string_equal(str->str, "");
+ assert_non_null(str);
str = bc_string_append_printf(str, "guda: %s %d", "bola", 1);
assert_non_null(str);
assert_string_equal(str->str, "guda: bola 1");