From: Sylvestre Ledru Date: Sun, 7 Jun 2026 09:43:43 +0000 (+0200) Subject: tests: ls: cover two-line --time-style format assignment X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=a04250cf3bb4b42be4d4f7ad005dcd473843174a;p=thirdparty%2Fcoreutils.git tests: ls: cover two-line --time-style format assignment * tests/ls/ls-time.sh: Check that with a "FORMAT1 NEWLINE FORMAT2" --time-style, FORMAT1 is used for non-recent (old) files and FORMAT2 for recent files. Identified here: https://github.com/uutils/coreutils/issues/12676 Closes https://github.com/coreutils/coreutils/pull/281 --- diff --git a/tests/ls/ls-time.sh b/tests/ls/ls-time.sh index 467c494cb7..1c8bf38020 100755 --- a/tests/ls/ls-time.sh +++ b/tests/ls/ls-time.sh @@ -154,4 +154,14 @@ if gettext --version >/dev/null 2>&1; then fi fi +# With a two-line --time-style format (FORMAT1 NEWLINE FORMAT2), +# FORMAT1 applies to non-recent (old) files and FORMAT2 to recent files. +touch -m recent || framework_failure_ +test $(($(date -r recent +%s) - $(date -r a +%s))) -gt $((31556952/2)) || + framework_failure_ +ls -l --time-style="+old-%Y +new-%Y" a recent >ts_out || fail=1 +grep -E "old-$(date -r a +%Y) a\$" ts_out && +grep -E "new-$(date -r recent +%Y) recent\$" ts_out || { cat ts_out; fail=1; } + Exit $fail