From 064a7dd7a8340375c18b0ede1b82c604b5b19bd4 Mon Sep 17 00:00:00 2001 From: Abhishek Chakravarti Date: Fri, 8 Mar 2019 10:34:52 +0530 Subject: [PATCH] Add sol_log_warn() unit test #2 Signed-off-by: Abhishek Chakravarti --- test/ts-log.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/test/ts-log.c b/test/ts-log.c index d0ebd3f..5daaa49 100644 --- a/test/ts-log.c +++ b/test/ts-log.c @@ -332,10 +332,6 @@ static sol_erno debug_test2(void) - - - - /* * warn_test1() - sol_log_warn() unit test #1 */ @@ -368,6 +364,21 @@ static sol_erno warn_test1(void) +/* + * warn_test2() - sol_log_warn() unit test #2 + */ +static sol_erno warn_test2(void) +{ + #define WARN_TEST2 "sol_log_warn() performs a safe no-op if called" \ + " when no log file is open" + + sol_log_warn("Dummy"); + return SOL_ERNO_NULL; +} + + + + /* * error_test1() - sol_log_error() unit test #1 */ @@ -458,6 +469,7 @@ extern sol_erno __sol_tests_log(sol_tlog *log, sol_try (sol_tsuite_register(ts, &debug_test1, DEBUG_DESC1)); sol_try (sol_tsuite_register(ts, &debug_test2, DEBUG_TEST2)); sol_try (sol_tsuite_register(ts, &warn_test1, WARN_DESC1)); + sol_try (sol_tsuite_register(ts, &warn_test2, WARN_TEST2)); sol_try (sol_tsuite_register(ts, &error_test1, ERROR_DESC1)); sol_try (sol_tsuite_register(ts, &erno_test1, ERNO_DESC1));