From b37222aeb3e6e2a2ebd715b82604dd9506683a65 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sun, 29 Dec 2024 16:47:00 +0100 Subject: [PATCH] refactor unicode.sh to use run_step() Signed-off-by: Joachim Wiberg --- test/unicode.sh | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/test/unicode.sh b/test/unicode.sh index 361ae36..b430069 100755 --- a/test/unicode.sh +++ b/test/unicode.sh @@ -1,21 +1,28 @@ #!/bin/sh # Currently only same as local.sh but with unicode messages # From https://github.com/troglobit/sysklogd/issues/49 -# shellcheck disable=SC1090 if [ -z "${srcdir}" ]; then srcdir=. fi . "${srcdir}/lib.sh" -setup -8 - MSG="öäüÖÄÜ߀¢§" MSG2="…‘’•" -logger ${MSG} -grep ${MSG} "${LOG}" || FAIL "Cannot find: ${MSG}" +setup_unicode() +{ + setup -8 -m0 +} + +check_log_message() +{ + message="${!#}" # Get last argument + [ $# -gt 1 ] && altsock="$1" -logger "${ALTSOCK}" ${MSG2} -grep ${MSG2} "${LOG}" || FAIL "Cannot find: ${MSG2}" + logger "${altsock}" "$message" + grep "$message" "$LOG" +} -OK +run_step "Set up unicode capable syslogd" setup_unicode +run_step "Verify logger" check_log_message "$MSG" +run_step "Verify logger w/ alt. socket" check_log_message "$ALTSOCK" "$MSG2"