From 5a00d0a651f40fe6257af42320438c3b88cdb363 Mon Sep 17 00:00:00 2001 From: =?utf8?q?P=C3=A1draig=20Brady?= Date: Tue, 28 Oct 2025 12:52:55 +0000 Subject: [PATCH] tests: fix new date/resolution.sh test on macOS * tests/date/resolution.sh: Fix comparison on systems with less than nano second reslution, where we use sed to discard the redundant trailing zeros output by date --resolution. Reported by Bruno Haible on macOS. --- tests/date/resolution.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/date/resolution.sh b/tests/date/resolution.sh index 730983dc99..4fbf4501f0 100755 --- a/tests/date/resolution.sh +++ b/tests/date/resolution.sh @@ -19,11 +19,12 @@ . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src print_ver_ date -# Ensure --resolution is supported +# Ensure --resolution is supported (prints to full nano second resolution) res=$(date --resolution) || fail=1 -# Ensure %-N format is supported -subsec1=$(printf "%s" "$res" | cut -d. -f2- | wc -c) || framework_failure_ +# Ensure %-N format is supported (prints to most concise resolution) +subsec1=$(printf '%s\n' "$res" | sed 's/.*\.//; s/0*$//' | wc -c) || + framework_failure_ subsec2=$(date +%-N | wc -c) || framework_failure_ test "$subsec1" = "$subsec2" || fail=1 -- 2.47.3