mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
src/lib/libast/tm/tmxfmt.c: - Making %l and %k aliases to %_I and %_H caused zero padding with %0l and %0k to fail. Fix that by fully implementing %l and %k without 'goto push'. This duplicates code from %I and %H, but it is necessary for these formats to work correctly when zero padded. src/cmd/ksh93/tests/builtins.sh: - Add a regression test for manually specifying blank and zero padding with sixteen different formats.
This commit is contained in:
parent
07b240d4f9
commit
83996d5a8b
2 changed files with 27 additions and 6 deletions
|
@ -797,6 +797,25 @@ unset foo
|
|||
[[ $(printf '%(%f)T') == $(printf '%(%Y.%m.%d-%H:%M:%S)T') ]] || err_exit 'date format %f is not the same as %Y.%m.%d-%H:%M:%S'
|
||||
[[ $(printf '%(%q)T') == $(printf '%(%Qz)T') ]] && err_exit 'date format %q is the same as %Qz'
|
||||
|
||||
# Test manually specified blank and zero padding with 'printf %T'
|
||||
(
|
||||
IFS=$'\n\t' # Preserve spaces in output
|
||||
for i in d e H I j J k l m M N S U V W y; do
|
||||
for f in ' ' 0; do
|
||||
if [[ $f == ' ' ]]; then
|
||||
padding='blank'
|
||||
specify='_'
|
||||
else
|
||||
padding='zero'
|
||||
specify='0'
|
||||
fi
|
||||
actual="$(printf "%(%${specify}${i})T" 'January 1 6AM 2001')"
|
||||
expect="${f}${actual:1}"
|
||||
[[ $expect != $actual ]] && err_exit "Specifying $padding padding with format '%$i' doesn't work (expected '$expect', got '$actual')"
|
||||
done
|
||||
done
|
||||
)
|
||||
|
||||
# ======
|
||||
# Test various AST getopts usage/manual outputs
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue