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 2 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, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 $Test::input_via_stdin = 1;
27 # test flags input expected output expected return code
28 ['a0', '-c', '', "0\n", 0],
29 ['a1', '-l', '', "0\n", 0],
30 ['a2', '-w', '', "0\n", 0],
31 ['a3', '-c', 'x', "1\n", 0],
32 ['a4', '-w', 'x', "1\n", 0],
33 ['a5', '-w', "x y\n", "2\n", 0],
34 ['a6', '-w', "x y\nz", "3\n", 0],
35 # Remember, -l counts *newline* bytes, not logical lines.
36 ['a7', '-l', "x y", "0\n", 0],
37 ['a8', '-l', "x y\n", "1\n", 0],
38 ['a9', '-l', "x\ny\n", "2\n", 0],
39 ['b0', '', "", "0 0 0\n", 0],
40 ['b1', '', "a b\nc\n", "2 3 6\n", 0],
41 ['c0', '-L', "1\n12\n", "2\n", 0],
42 ['c1', '-L', "1\n123\n1\n", "3\n", 0],
43 ['c2', '-L', "\n123456", "6\n", 0],
51 my ($test_name, $flags, $in, $exp, $ret) = @$t;
52 # By default, test both stdin-redirection and input from a pipe.
53 $Test::input_via{$test_name} = {REDIR => 0, PIPE => 0};
55 # But if test name ends with `-file', test only with file arg(s).
56 # FIXME: unfortunately, invoking wc like `wc FILE' makes it put
57 # FILE in the ouput -- and FILE is different depending on $srcdir.
58 $Test::input_via{$test_name} = {FILE => 0}
59 if $test_name =~ /-file$/;
61 # Now that `wc FILE' (note, with no options) produces results
62 # different from `cat FILE|wc', disable those two `PIPE' tests.
64 and delete $Test::input_via{$test_name}->{PIPE};