coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: date/resolution test failure on macOS


From: Pádraig Brady
Subject: Re: date/resolution test failure on macOS
Date: Tue, 28 Oct 2025 12:58:32 +0000
User-agent: Mozilla Thunderbird Beta

On 28/10/2025 08:10, Bruno Haible via GNU coreutils General Discussion wrote:
The test tests/date/resolution, that was added last week in commit
1dabab70273f64cda228d244f9e262a3f77ef087, fails on macOS (13..26).

Oops, I misunderstood the format of date --resolution.
I pushed the following, which should fix this.

cheers,
Padraig

diff --git a/tests/date/resolution.sh b/tests/date/resolution.sh
index 730983dc9..4fbf4501f 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]