mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-02-21 06:42:02 +02:00
* tests/check.mk (TESTS_ENVIRONMENT): Save and restore TMPDIR around envvar-check, so that the few scripts that require $TMPDIR don't fail. This is also good to let a user's default TMPDIR setting be used e.g., in the search for an 'other-partition'. FIXME: this is pretty ugly. maybe undo it and find a better way. (TESTS_ENVIRONMENT): Invoke perl scripts with $(PERL), and use -T if the script requires that. Otherwise, use $(SHELL). * tests/misc/md5sum-newline: Create a file whose name contains a newline in Perl (resort to using "system", since open refuses). Fix old brokenness exposed by this change: * tests/du/files0-from: Correct test not to rely on stdin being attached to a non-tty. * tests/misc/sort (3g, 3h, 3i): Likewise: add explicit empty input file. Avoid warnings about using qw()-around-commas. * tests/rm/fail-eperm: Now that this test is run from a temporary subdirectory, adjust the full name of the "rm" program we're going to run. Change #!/bin/sh to #!/usr/bin/perl, and factor out the few lines of boilerplate code to invoke perl. Do not "require 5.00x"; a configure-time Perl test handles that * tests/dd/skip-seek: * tests/misc/base64: * tests/misc/basename: * tests/misc/cut: * tests/misc/date: * tests/misc/dircolors: * tests/misc/dirname: * tests/misc/expand: * tests/misc/expr: * tests/misc/factor: * tests/misc/fmt: * tests/misc/fold: * tests/misc/head: * tests/misc/head-elide-tail: * tests/misc/join: * tests/misc/ls-misc: * tests/misc/md5sum: * tests/misc/md5sum-newline: * tests/misc/mktemp: * tests/misc/od: * tests/misc/paste: * tests/misc/pr: * tests/misc/printf-cov: * tests/misc/seq: * tests/misc/sha1sum: * tests/misc/sha1sum-vec: * tests/misc/sha224sum: * tests/misc/sha256sum: * tests/misc/sha384sum: * tests/misc/sha512sum: * tests/misc/sort-merge: * tests/misc/stat-printf: * tests/misc/sum: * tests/misc/tac: * tests/misc/tail: * tests/misc/test: * tests/misc/test-diag: * tests/misc/tr: * tests/misc/tsort: * tests/misc/tty-eof: * tests/misc/unexpand: * tests/misc/uniq: * tests/misc/wc: * tests/misc/wc-files0-from: * tests/misc/xstrtol: * tests/mv/i-1: * tests/pr/pr-tests: * tests/rm/empty-name: * tests/rm/fail-eperm: * tests/rm/unreadable:
66 lines
2.3 KiB
Perl
Executable File
66 lines
2.3 KiB
Perl
Executable File
#!/usr/bin/perl
|
|
# Basic tests for "fmt".
|
|
|
|
# Copyright (C) 2001, 2002, 2003, 2004, 2005-2008 Free Software
|
|
# Foundation, Inc.
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
use strict;
|
|
|
|
(my $program_name = $0) =~ s|.*/||;
|
|
|
|
my @Tests =
|
|
(
|
|
['8-bit-pfx', qw (-p 'ç'),
|
|
{IN=> "ça\nçb\n"},
|
|
{OUT=>"ça b\n"}],
|
|
['wide-1', '-w 32768',
|
|
{ERR => "fmt: invalid width: `32768'\n"}, {EXIT => 1}],
|
|
['wide-2', '-w 2147483647',
|
|
{ERR => "fmt: invalid width: `2147483647'\n"}, {EXIT => 1}],
|
|
['bad-suffix', '-72x', {IN=> ''},
|
|
{ERR => "fmt: invalid width: `72x'\n"}, {EXIT => 1}],
|
|
['no-file', 'no-such-file',
|
|
{ERR => "fmt: cannot open `no-such-file' for reading:"
|
|
. " No such file or directory\n"}, {EXIT => 1}],
|
|
['obs-1', '-c -72',
|
|
{ERR => "fmt: invalid option -- 7; -WIDTH is recognized only when it"
|
|
. " is the first\noption; use -w N instead\n"
|
|
. "Try `fmt --help' for more information.\n" }, {EXIT => 1}],
|
|
|
|
# With --prefix=P, do not remove leading space on lines without the prefix.
|
|
['pfx-1', qw (-p '>'),
|
|
{IN=> " 1\n 2\n\t3\n\t\t4\n> quoted\n> text\n"},
|
|
{OUT=> " 1\n 2\n\t3\n\t\t4\n> quoted text\n"}],
|
|
|
|
# Don't remove prefix from a prefix-only line.
|
|
['pfx-only', qw (-p '>'),
|
|
{IN=> ">\n"},
|
|
{OUT=> ">\n"}],
|
|
|
|
# With a multi-byte prefix, say, "foo", don't empty a line that
|
|
# starts with a strict prefix (e.g. "fo") of that prefix.
|
|
# With fmt from coreutils-6.7, it would mistakenly output an empty line.
|
|
['pfx-of-pfx', qw (-p 'foo'),
|
|
{IN=> "fo\n"},
|
|
{OUT=> "fo\n"}],
|
|
);
|
|
|
|
my $save_temps = $ENV{DEBUG};
|
|
my $verbose = $ENV{VERBOSE};
|
|
my $prog = 'fmt';
|
|
my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
|
|
exit $fail;
|