7 $PERL -e 1 > /dev/null 2>&1 || {
8 echo 1>&2 "$0: configure didn't find a usable version of Perl," \
9 "so can't run this test"
13 # Export this to avoid hassles when run in a UTF-8 locale,
14 # since we use 8-bit characters below, and those values are
15 # interpolated into strings (to perform substitution) in Coreutils.pm.
19 exec $PERL -w -I$srcdir/.. -MCoreutils -- - <<\EOF
23 (my $program_name = $0) =~ s|.*/||;
27 ['8-bit-pfx', qw (-p 'ç'),
30 ['wide-1', '-w 32768',
31 {ERR => "fmt: invalid width: `32768'\n"}, {EXIT => 1}],
32 ['wide-2', '-w 2147483647',
33 {ERR => "fmt: invalid width: `2147483647'\n"}, {EXIT => 1}],
34 ['bad-suffix', '-72x', {IN=> ''},
35 {ERR => "fmt: invalid width: `72x'\n"}, {EXIT => 1}],
36 ['no-file', 'no-such-file',
37 {ERR => "fmt: cannot open `no-such-file' for reading:"
38 . " No such file or directory\n"}, {EXIT => 1}],
40 {ERR => "fmt: invalid option -- 7; -WIDTH is recognized only when it"
41 . " is the first\noption; use -w N instead\n"
42 . "Try `fmt --help' for more information.\n" }, {EXIT => 1}],
44 # With --prefix=P, Do not remove leading on lines without the prefix.
45 ['pfx-1', qw (-p '>'),
46 {IN=> " 1\n 2\n\t3\n\t\t4\n> quoted\n> text\n"},
47 # This is the buggy output (leading white space removed),
48 # from coreutils-5.93.
49 {OUT=> "1\n2\n3\n4\n> quoted text\n"}],
50 # FIXME: this is the desired output
51 # {OUT=> " 1\n 2\n\t3\n\t\t4\n> quoted text\n"}],
53 # Like the above, but when two adjacent, non-prefixed lines have
54 # the same indentation, ensure that they are formatted.
55 ['pfx-2', qw (-p '>'),
56 {IN=> " 1\n 2\n\t3\n\t4\n"},
57 {OUT=> "1\n2\n3\n4\n"}],
58 # FIXME: this is the desired output
59 # {OUT=> " 1 2\n\t3 4\n"}],
62 my $save_temps = $ENV{DEBUG};
63 my $verbose = $ENV{VERBOSE};
65 my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
66 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);