dos2unix: tiny shrink
[oweals/busybox.git] / testsuite / sort.tests
index cd2e291b20393aac5c065dafe648ae2b216ab6c6..f700dc0c16ca1992e82be9e955b41d586fe45ef9 100755 (executable)
@@ -56,7 +56,7 @@ testing "sort key range with numeric option and global reverse" \
 7      3       42      soup
 " "$data" ""
 
-# 
+#
 
 testing "sort key range with multiple options" "sort -k2,3rn input" \
 "7     3       42      soup
@@ -66,18 +66,54 @@ testing "sort key range with multiple options" "sort -k2,3rn input" \
 egg    1       2       papyrus
 " "$data" ""
 
+testing "sort key range with two -k options" "sort -k 2,2n -k 1,1r input" "\
+d 2
+b 2
+c 3
+" "\
+c 3
+b 2
+d 2
+" ""
+
+testing "sort with non-default leading delim 1" "sort -n -k2 -t/ input" "\
+/a/2
+/b/1
+" "\
+/a/2
+/b/1
+" ""
+
+testing "sort with non-default leading delim 2" "sort -n -k3 -t/ input" "\
+/b/1
+/a/2
+" "\
+/b/1
+/a/2
+" ""
+
+testing "sort with non-default leading delim 3" "sort -n -k3 -t/ input" "\
+//a/2
+//b/1
+" "\
+//a/2
+//b/1
+" ""
+
+testing "sort -u should consider field only when discarding" "sort -u -k2 input" "\
+a c
+" "\
+a c
+b c
+" ""
+
+testing "sort -z outputs NUL terminated lines" "sort -z input" "\
+one\0three\0two\0\
+" "\
+one\0two\0three\0\
+" ""
+
 testing "sort key doesn't strip leading blanks, disables fallback global sort" \
-"sort -n -k2 -t ' '" " a \n 1 \n 2 \n" "" " 2 \n 1 \n a \n" 
-
-testing "sort key edge case with -t" "sort -n -k4 -t/" \
-"/usr/lib/finish-install.d/1
-/usr/lib/finish-install.d/4
-/usr/lib/prebaseconfig.d/2
-/usr/lib/prebaseconfig.d/6
-" "" "/usr/lib/finish-install.d/1
-/usr/lib/prebaseconfig.d/2
-/usr/lib/finish-install.d/4
-/usr/lib/prebaseconfig.d/6
-"
+"sort -n -k2 -t ' '" " a \n 1 \n 2 \n" "" " 2 \n 1 \n a \n"
 
 exit $FAILCOUNT