summaryrefslogtreecommitdiffstats
path: root/t/test_umberlog.c
diff options
context:
space:
mode:
Diffstat (limited to 't/test_umberlog.c')
-rw-r--r--t/test_umberlog.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/t/test_umberlog.c b/t/test_umberlog.c
index 07b2d17..291bf43 100644
--- a/t/test_umberlog.c
+++ b/t/test_umberlog.c
@@ -15,6 +15,36 @@
#include <check.h>
+START_TEST (test_defaults)
+{
+ char *msg;
+ struct json_object *jo;
+
+ char host[_POSIX_HOST_NAME_MAX + 1];
+
+ ul_openlog ("umberlog/test_defaults", 0, LOG_LOCAL0);
+
+ msg = ul_format (LOG_DEBUG, "hello, I'm %s!", __FUNCTION__, NULL);
+ jo = parse_msg (msg);
+ free (msg);
+
+ gethostname (host, _POSIX_HOST_NAME_MAX);
+
+ verify_value (jo, "msg", "hello, I'm test_defaults!");
+ verify_value (jo, "facility", "local0");
+ verify_value (jo, "priority", "debug");
+ verify_value (jo, "program", "umberlog/test_defaults");
+ verify_value_exists (jo, "pid");
+ verify_value_exists (jo, "uid");
+ verify_value_exists (jo, "gid");
+ verify_value_exists (jo, "timestamp");
+ verify_value (jo, "host", host);
+
+ json_object_put (jo);
+
+ ul_closelog ();
+}
+END_TEST
START_TEST (test_overrides)
{
@@ -229,6 +259,7 @@ main (void)
s = suite_create ("Umberlog (linkable) functional testsuite");
ft = tcase_create ("Basic tests");
+ tcase_add_test (ft, test_defaults);
tcase_add_test (ft, test_overrides);
tcase_add_test (ft, test_ul_openlog);
tcase_add_test (ft, test_ul_openlog_flag_ignore);