2 # Show that wc's new --files0-from option works.
4 # Copyright (C) 2006-2016 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=.}/tests/init.sh"; path_prepend_ .
/src
22 echo 2 > 2b || framework_failure_
23 echo 2 words
> 2w || framework_failure_
24 printf '2b\n2w\n' |
tr '\n' '\0' > names || framework_failure_
27 wc --files0-from=names
> out || fail
=1
28 cat <<\EOF
> exp || fail
=1
34 compare exp out || fail
=1
36 if ! test "$fail" = 1; then
37 # Repeat the above test, but read the file name list from stdin.
39 wc --files0-from=- < names
> out || fail
=1
40 compare exp out || fail
=1
43 # Ensure file name containing new lines are output on a single line
46 touch "$nlname" || framework_failure_
47 printf '%s\0' "$nlname" |
wc --files0-from=- > out || fail
=1
48 printf '%s\n' "0 0 0 '1'$'\\n''2'" > exp || framework_failure_
49 compare exp out || fail
=1