From 224a69b56b716f57e3a018af5a9b9379f32da3fc Mon Sep 17 00:00:00 2001 From: Pádraig Brady Date: Tue, 24 Feb 2009 08:37:18 +0000 Subject: 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. --- tests/misc/sort | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests') 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"}], -- cgit v1.2.3-70-g09d2