3 # Copyright (C) 1997, 2003, 2006 Free Software Foundation, Inc.
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
22 $Test::input_via_stdin = 1;
25 # test flags input expected output expected return code
26 ['a0', '-c', '', "0\n", 0],
27 ['a1', '-l', '', "0\n", 0],
28 ['a2', '-w', '', "0\n", 0],
29 ['a3', '-c', 'x', "1\n", 0],
30 ['a4', '-w', 'x', "1\n", 0],
31 ['a5', '-w', "x y\n", "2\n", 0],
32 ['a6', '-w', "x y\nz", "3\n", 0],
33 # Remember, -l counts *newline* bytes, not logical lines.
34 ['a7', '-l', "x y", "0\n", 0],
35 ['a8', '-l', "x y\n", "1\n", 0],
36 ['a9', '-l', "x\ny\n", "2\n", 0],
37 ['b0', '', "", "0 0 0\n", 0],
38 ['b1', '', "a b\nc\n", "2 3 6\n", 0],
39 ['c0', '-L', "1\n12\n", "2\n", 0],
40 ['c1', '-L', "1\n123\n1\n", "3\n", 0],
41 ['c2', '-L', "\n123456", "6\n", 0],
49 my ($test_name, $flags, $in, $exp, $ret) = @$t;
50 # By default, test both stdin-redirection and input from a pipe.
51 $Test::input_via{$test_name} = {REDIR => 0, PIPE => 0};
53 # But if test name ends with `-file', test only with file arg(s).
54 # FIXME: unfortunately, invoking wc like `wc FILE' makes it put
55 # FILE in the ouput -- and FILE is different depending on $srcdir.
56 $Test::input_via{$test_name} = {FILE => 0}
57 if $test_name =~ /-file$/;
59 # Now that `wc FILE' (note, with no options) produces results
60 # different from `cat FILE|wc', disable those two `PIPE' tests.
62 and delete $Test::input_via{$test_name}->{PIPE};