Skip to content

Commit

Permalink
refactor unicode.sh to use run_step()
Browse files Browse the repository at this point in the history
Signed-off-by: Joachim Wiberg <[email protected]>
  • Loading branch information
troglobit committed Dec 29, 2024
1 parent 89f50b9 commit b37222a
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions test/unicode.sh
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit b37222a

Please sign in to comment.