1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-07-30 12:29:31 +02:00

tests: add test for locale decimal processing

* tests/misc/sleep.sh: Check locale processing of printf, sleep,
and timeout, when the french locale data is available.
This commit is contained in:
Pádraig Brady
2019-01-27 21:34:52 -08:00
parent 001897e7e2
commit 90933c8eb0
+14 -1
View File
@@ -17,7 +17,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ sleep
print_ver_ sleep printf
getlimits_
# invalid timeouts
@@ -39,4 +39,17 @@ returns_ 124 timeout 0.1 sleep 1d 2h 3m 4s || fail=1
returns_ 124 timeout 0.1 sleep inf || fail=1
returns_ 124 timeout 0.1 sleep $LDBL_MAX || fail=1
# Test locale decimal handling for printf, sleep, timeout
: ${LOCALE_FR_UTF8=none}
if test "$LOCALE_FR_UTF8" != "none"; then
f=$LOCALE_FR_UTF8
locale_decimal=$(LC_ALL=$f env printf '%0.3f' 0.001) || fail=1
locale_decimal=$(LC_ALL=$f env printf '%0.3f' "$locale_decimal") || fail=1
case "$locale_decimal" in
0?001)
LC_ALL=$f timeout 1$locale_decimal sleep "$locale_decimal" || fail=1 ;;
*) fail=1 ;;
esac
fi
Exit $fail