* tests/du/block-size.sh (test_unit): Test that the locales thousands
separator is used if we can determine it.
---
 tests/du/block-size.sh | 39 +++++++++++++++++++++++++++++----------
 1 file changed, 29 insertions(+), 10 deletions(-)

diff --git a/tests/du/block-size.sh b/tests/du/block-size.sh
index 4d2b93b3b..0d85e5f8d 100755
--- a/tests/du/block-size.sh
+++ b/tests/du/block-size.sh
@@ -56,16 +56,35 @@ test_unit ()
   # When there is a prefix of 1, the unit is not printed.  Setup a file
   # to compare to.
   sed 's/^\([0-9][0-9]*\)'"$upper"'/\1/g' <exp >exp1 || framework_failure_
-  for opt in BLOCK_SIZE -B --block-size=; do
-    for c in $lower $upper; do
-      for prefix in '' 1; do
-        case $opt in
-          -*) env=; arg=$opt$prefix$c ;;
-          *) arg=; env=$opt=$prefix$c ;;
-        esac
-        env $env du -A $arg 1* >out 2>err || fail=1
-        compare exp$prefix out || fail=1
-        compare /dev/null err || fail=1
+  for loc in C "$LOCALE_FR" "$LOCALE_FR_UTF8"; do
+    test -z "$loc" && continue
+    thousands_sep=$(LC_ALL=$loc locale thousands_sep)
+    test -z "$thousands_sep" && continue
+    for f in exp exp1; do
+      LC_ALL=$loc \
+        sed 's/^\([0-9][0-9]*\)\([0-9]\{3\}\)/\1'"$thousands_sep"'\2/g' $f \
+          >$loc$f || framework_failure_
+    done
+    for opt in BLOCK_SIZE -B --block-size=; do
+      for c in $lower $upper; do
+        for prefix1 in '' "'"; do
+          # Without the apostrophe thousands separators aren't used,
+          # regardless of locale.
+          if test -z "$prefix1"; then
+            exp=exp
+          else
+            exp="$loc"exp
+          fi
+          for prefix2 in '' 1; do
+            case $opt in
+              -*) env=; arg=$opt$prefix1$prefix2$c ;;
+              *) arg=; env=$opt=$prefix1$prefix2$c ;;
+            esac
+            env LC_ALL=$loc $env du -A $arg 1* >out 2>err || fail=1
+            compare $exp$prefix2 out || fail=1
+            compare /dev/null err || fail=1
+          done
+        done
       done
     done
   done
-- 
2.55.0


Reply via email to