tests: change copyright year from 2011 to 2012 in sample-test
[coreutils/ericb.git] / tests / misc / sort-debug-warn
blob5ae00022cf0c0889ec78de0d8142b496240c204f
1 #!/bin/sh
2 # Test warnings for sort options
4 # Copyright (C) 2010-2011 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 . "${srcdir=.}/init.sh"; path_prepend_ ../src
20 print_ver_ sort
22 cat <<\EOF > exp
23 sort: using simple byte comparison
24 sort: key 1 has zero width and will be ignored
25 sort: using simple byte comparison
26 sort: key 1 has zero width and will be ignored
27 sort: using simple byte comparison
28 sort: key 1 is numeric and spans multiple fields
29 sort: using simple byte comparison
30 sort: options `-bghMRrV' are ignored
31 sort: using simple byte comparison
32 sort: options `-bghMRV' are ignored
33 sort: option `-r' only applies to last-resort comparison
34 sort: using simple byte comparison
35 sort: option `-r' only applies to last-resort comparison
36 sort: using simple byte comparison
37 sort: options `-bg' are ignored
38 sort: using simple byte comparison
39 sort: using simple byte comparison
40 sort: option `-b' is ignored
41 sort: using simple byte comparison
42 sort: using simple byte comparison
43 sort: using simple byte comparison
44 sort: leading blanks are significant in key 1; consider also specifying `b'
45 sort: using simple byte comparison
46 sort: leading blanks are significant in key 1; consider also specifying `b'
47 sort: option `-d' is ignored
48 sort: using simple byte comparison
49 sort: leading blanks are significant in key 1; consider also specifying `b'
50 sort: option `-i' is ignored
51 sort: using simple byte comparison
52 sort: using simple byte comparison
53 sort: using simple byte comparison
54 EOF
56 sort -s -k2,1 --debug /dev/null 2>>out
57 sort -s -k2,1n --debug /dev/null 2>>out
58 sort -s -k1,2n --debug /dev/null 2>>out
59 sort -s -rRVMhgb -k1,1n --debug /dev/null 2>>out
60 sort -rRVMhgb -k1,1n --debug /dev/null 2>>out
61 sort -r -k1,1n --debug /dev/null 2>>out
62 sort -gbr -k1,1n -k1,1r --debug /dev/null 2>>out
63 sort -b -k1b,1bn --debug /dev/null 2>>out # no warning
64 sort -b -k1,1bn --debug /dev/null 2>>out
65 sort -b -k1,1bn -k2b,2 --debug /dev/null 2>>out # no warning
66 sort -r -k1,1r --debug /dev/null 2>>out # no warning for redundant options
67 sort -i -k1,1i --debug /dev/null 2>>out # no warning
68 sort -d -k1,1b --debug /dev/null 2>>out
69 sort -i -k1,1d --debug /dev/null 2>>out
70 sort -r --debug /dev/null 2>>out #no warning
71 sort -rM --debug /dev/null 2>>out #no warning
72 sort -rM -k1,1 --debug /dev/null 2>>out #no warning
74 compare exp out || fail=1
76 cat <<\EOF > exp
77 sort: using simple byte comparison
78 sort: key 1 is numeric and spans multiple fields
79 sort: obsolescent key `+2 -1' used; consider `-k 3,1' instead
80 sort: key 2 has zero width and will be ignored
81 sort: leading blanks are significant in key 2; consider also specifying `b'
82 sort: option `-b' is ignored
83 sort: option `-r' only applies to last-resort comparison
84 EOF
86 sort --debug -rb -k2n +2.2 -1b /dev/null 2>out
88 compare exp out || fail=1
90 Exit $fail