summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKamil Dudka <kdudka@redhat.com>2016-07-18 19:04:45 +0200
committerPádraig Brady <P@draigBrady.com>2016-07-18 22:24:26 +0100
commit0f9fc7b3b9aee1d001ca60de1125e6e714e70ac7 (patch)
tree87b3a57b2cf165447146a9d9238a8da2cb876239 /tests
parentdfbc945a562f870f6647672374c00d4f1ffb6097 (diff)
downloadcoreutils-0f9fc7b3b9aee1d001ca60de1125e6e714e70ac7.tar.xz
sort: with -h, disallow thousands separator between number and unit
* src/sort.c (traverse_raw_number): Accept thousands separator only if it is immediately followed by a digit. * tests/misc/sort-h-thousands-sep.sh: Cover the fix for this bug. Suggested by Pádraig Brady in http://bugs.gnu.org/24015
Diffstat (limited to 'tests')
-rwxr-xr-xtests/misc/sort-h-thousands-sep.sh25
1 files changed, 13 insertions, 12 deletions
diff --git a/tests/misc/sort-h-thousands-sep.sh b/tests/misc/sort-h-thousands-sep.sh
index 17f1b6c98..3ffa89eeb 100755
--- a/tests/misc/sort-h-thousands-sep.sh
+++ b/tests/misc/sort-h-thousands-sep.sh
@@ -18,28 +18,29 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ sort
+
test "$(LC_ALL=sv_SE locale thousands_sep)" = ' ' \
|| skip_ 'The Swedish locale with blank thousands separator is unavailable.'
-tee exp1 > in << _EOF_
-1 1k 4 003 1M
-2k 2M 4 002 2
-3M 3 4 001 3k
+tee exp1 exp3 > in << _EOF_
+1 1k 1 M 4 003 1M
+2k 2M 2 k 4 002 2
+3M 3 3 G 4 001 3k
_EOF_
cat > exp2 << _EOF_
-3M 3 4 001 3k
-1 1k 4 003 1M
-2k 2M 4 002 2
+3M 3 3 G 4 001 3k
+1 1k 1 M 4 003 1M
+2k 2M 2 k 4 002 2
_EOF_
-cat > exp3 << _EOF_
-3M 3 4 001 3k
-2k 2M 4 002 2
-1 1k 4 003 1M
+cat > exp5 << _EOF_
+3M 3 3 G 4 001 3k
+2k 2M 2 k 4 002 2
+1 1k 1 M 4 003 1M
_EOF_
-for i in 1 2 3; do
+for i in 1 2 3 5; do
LC_ALL="sv_SE.utf8" sort -h -k $i "in" > "out${i}" || fail=1
compare "exp${i}" "out${i}" || fail=1
done