aboutsummaryrefslogtreecommitdiffstats
path: root/tests/common/check_error.c
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2019-09-09 20:44:18 +0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2019-09-09 20:44:25 +0200
commita576156e5bf9de147efe2c76af1ee29f5efd773e (patch)
treea72f60f78cd4db77ce5d10d084b6d1c8e1e0fe27 /tests/common/check_error.c
parentc9df78f02b66513c6e831d81c3240a715fee7e70 (diff)
downloadblogc-a576156e5bf9de147efe2c76af1ee29f5efd773e.tar.gz
blogc-a576156e5bf9de147efe2c76af1ee29f5efd773e.tar.bz2
blogc-a576156e5bf9de147efe2c76af1ee29f5efd773e.zip
common: prevent stdarg errors when format is NULL
Diffstat (limited to 'tests/common/check_error.c')
-rw-r--r--tests/common/check_error.c7
1 files changed, 6 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");