summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2009-02-24 08:37:18 +0000
committerPádraig Brady <P@draigBrady.com>2009-02-26 14:40:28 +0000
commit224a69b56b716f57e3a018af5a9b9379f32da3fc (patch)
tree68d8a3efffc2ce74a4805dc1c8c372df87850306 /tests
parent9a2a8f0b3e01be360e8e928a7b583e05d22b89ff (diff)
downloadcoreutils-224a69b56b716f57e3a018af5a9b9379f32da3fc.tar.xz
sort: Fix two bugs with determining the end of field
* src/sort.c: When no specific number of chars to skip is specified for the end field, always skip the whole field. Also never include leading spaces from next field. * tests/misc/sort: Add 2 new tests for these cases. * NEWS: Mention this bug fix. * THANKS: Add bug reporter. Reported by Davide Canova.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/misc/sort6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/misc/sort b/tests/misc/sort
index 3e8eda6ae..3af2388a5 100755
--- a/tests/misc/sort
+++ b/tests/misc/sort
@@ -110,6 +110,8 @@ my @Tests =
["07b", '-k 2,3', {IN=>"a a b\nz a a\n"}, {OUT=>"z a a\na a b\n"}],
["07c", '-k 2,3', {IN=>"y k b\nz k a\n"}, {OUT=>"z k a\ny k b\n"}],
["07d", '+1 -3', {IN=>"y k b\nz k a\n"}, {OUT=>"z k a\ny k b\n"}],
+# ensure a character position of 0 includes whole field
+["07e", '-k 2,3.0', {IN=>"a a b\nz a a\n"}, {OUT=>"z a a\na a b\n"}],
#
# report an error for `.' without following char spec
["08a", '-k 2.,3', {EXIT=>2},
@@ -210,6 +212,10 @@ my @Tests =
# key start and key end.
["18e", '-nb -k1.1,1.2', {IN=>" 901\n100\n"}, {OUT=>"100\n 901\n"}],
+# When ignoring leading blanks for end position, ensure blanks from
+# next field are not included in the sort. I.E. order should not change here.
+["18f", '-k1,1b', {IN=>"a y\na z\n"}, {OUT=>"a y\na z\n"}],
+
# This looks odd, but works properly -- 2nd keyspec is never
# used because all lines are different.
["19a", '+0 +1nr', {IN=>"b 2\nb 1\nb 3\n"}, {OUT=>"b 1\nb 2\nb 3\n"}],