tests: cksum: add incorrect data to verify --check & --strict
[coreutils.git] / tests / ls / w-option.sh
blob090a8dc5927817a33eebcf446850d54da39c6fc9
1 #!/bin/sh
2 # exercise the -w option
4 # Copyright (C) 2015-2024 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 <https://www.gnu.org/licenses/>.
19 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
20 print_ver_ ls
21 getlimits_
23 touch a b || framework_failure_
24 chmod a+x a || framework_failure_
26 # Negative values disallowed
27 returns_ 2 ls -w-1 || fail=1
29 # Verify octal parsing (especially since 0 is allowed)
30 returns_ 2 ls -w08 || fail=1
32 # Overflowed values are capped at SIZE_MAX
33 ls -w$SIZE_OFLOW || fail=1
35 # After coreutils 8.24 -w0 means no limit
36 # and delimiting with spaces
37 ls -w0 -x -T1 a b > out || fail=1
38 printf '%s\n' 'a b' > exp || framework_failure_
39 compare exp out || fail=1
41 # Ensure that 0 line length doesn't cause division by zero
42 TERM=xterm ls -w0 -x --color=always || fail=1
44 # coreutils <= 8.24 could display 1 column too few
45 ls -w4 -x -T0 a b > out || fail=1
46 compare exp out || fail=1
48 Exit $fail