From 90933c8eb0efc2a718fae44a22e89fc4e0f49cc9 Mon Sep 17 00:00:00 2001
From: =?utf8?q?P=C3=A1draig=20Brady?=
Date: Sun, 27 Jan 2019 21:34:52 -0800
Subject: [PATCH] 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.
---
tests/misc/sleep.sh | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/tests/misc/sleep.sh b/tests/misc/sleep.sh
index c20ce011fd..b5934d8060 100755
--- a/tests/misc/sleep.sh
+++ b/tests/misc/sleep.sh
@@ -17,7 +17,7 @@
# along with this program. If not, see .
. "${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
--
2.47.2