mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-04-18 17:56:54 +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:
88 lines
3.9 KiB
Perl
Executable File
88 lines
3.9 KiB
Perl
Executable File
#!/usr/bin/perl
|
|
# Test "unexpand".
|
|
|
|
# Copyright (C) 2000, 2003-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|.*/||;
|
|
|
|
# Turn off localization of executable's output.
|
|
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
|
|
|
|
my $prog = 'unexpand';
|
|
|
|
my @Tests =
|
|
(
|
|
['a1', {IN=> ' 'x 1 ."y\n"}, {OUT=> ' 'x 1 ."y\n"}],
|
|
['a2', {IN=> ' 'x 2 ."y\n"}, {OUT=> ' 'x 2 ."y\n"}],
|
|
['a3', {IN=> ' 'x 3 ."y\n"}, {OUT=> ' 'x 3 ."y\n"}],
|
|
['a4', {IN=> ' 'x 4 ."y\n"}, {OUT=> ' 'x 4 ."y\n"}],
|
|
['a5', {IN=> ' 'x 5 ."y\n"}, {OUT=> ' 'x 5 ."y\n"}],
|
|
['a6', {IN=> ' 'x 6 ."y\n"}, {OUT=> ' 'x 6 ."y\n"}],
|
|
['a7', {IN=> ' 'x 7 ."y\n"}, {OUT=> ' 'x 7 ."y\n"}],
|
|
['a8', {IN=> ' 'x 8 ."y\n"}, {OUT=> "\ty\n"}],
|
|
|
|
['aa-1', '-a', {IN=> 'w'.' 'x 1 ."y\n"}, {OUT=> 'w'.' 'x 1 ."y\n"}],
|
|
['aa-2', '-a', {IN=> 'w'.' 'x 2 ."y\n"}, {OUT=> 'w'.' 'x 2 ."y\n"}],
|
|
['aa-3', '-a', {IN=> 'w'.' 'x 3 ."y\n"}, {OUT=> 'w'.' 'x 3 ."y\n"}],
|
|
['aa-4', '-a', {IN=> 'w'.' 'x 4 ."y\n"}, {OUT=> 'w'.' 'x 4 ."y\n"}],
|
|
['aa-5', '-a', {IN=> 'w'.' 'x 5 ."y\n"}, {OUT=> 'w'.' 'x 5 ."y\n"}],
|
|
['aa-6', '-a', {IN=> 'w'.' 'x 6 ."y\n"}, {OUT=> 'w'.' 'x 6 ."y\n"}],
|
|
['aa-7', '-a', {IN=> 'w'.' 'x 7 ."y\n"}, {OUT=> "w\ty\n"}],
|
|
['aa-8', '-a', {IN=> 'w'.' 'x 8 ."y\n"}, {OUT=> "w\t y\n"}],
|
|
|
|
['b-1', '-t', '2,4', {IN=> " ."}, {OUT=>"\t\t ."}],
|
|
# These would infloop prior to textutils-2.0d.
|
|
|
|
['infloop-1', '-t', '1,2', {IN=> " \t\t .\n"}, {OUT=>"\t\t\t .\n"}],
|
|
['infloop-2', '-t', '4,5', {IN=> ' 'x4 . "\t\t \n"}, {OUT=>"\t\t\t \n"}],
|
|
['infloop-3', '-t', '2,3', {IN=> "x \t\t \n"}, {OUT=>"x \t\t \n"}],
|
|
['infloop-4', '-t', '1,2', {IN=> " \t\t \n"}, {OUT=>"\t\t\t \n"}],
|
|
['c-1', '-t', '1,2', {IN=> "x\t\t .\n"}, {OUT=>"x\t\t .\n"}],
|
|
|
|
# -t implies -a
|
|
# Feature addition (--first-only) prompted by a report from Jie Xu.
|
|
['tabs-1', qw(-t 3), {IN=> " a b\n"}, {OUT=>"\ta\tb\n"}],
|
|
['tabs-2', qw(-t 3 --first-only), {IN=> " a b\n"}, {OUT=>"\ta b\n"}],
|
|
|
|
# blanks
|
|
['blanks-1', qw(-t 1), {IN=> " b c d\n"}, {OUT=> "\tb\t\tc\t\t\td\n"}],
|
|
['blanks-2', qw(-t 1), {IN=> "a \n"}, {OUT=> "a \n"}],
|
|
['blanks-3', qw(-t 1), {IN=> "a \n"}, {OUT=> "a\t\t\n"}],
|
|
['blanks-4', qw(-t 1), {IN=> "a \n"}, {OUT=> "a\t\t\t\n"}],
|
|
['blanks-5', qw(-t 1), {IN=> "a "}, {OUT=> "a "}],
|
|
['blanks-6', qw(-t 1), {IN=> "a "}, {OUT=> "a\t\t"}],
|
|
['blanks-7', qw(-t 1), {IN=> "a "}, {OUT=> "a\t\t\t"}],
|
|
['blanks-8', qw(-t 1), {IN=> " a a a\n"}, {OUT=> "\ta a\t\ta\n"}],
|
|
['blanks-9', qw(-t 2), {IN=> " a a a\n"}, {OUT=> "\t a\ta a\n"}],
|
|
['blanks-10', '-t', '3,4', {IN=> "0 2 4 6\t8\n"}, {OUT=> "0 2 4 6\t8\n"}],
|
|
['blanks-11', '-t', '3,4', {IN=> " 4\n"}, {OUT=> "\t\t4\n"}],
|
|
['blanks-12', '-t', '3,4', {IN=> "01 4\n"}, {OUT=> "01\t\t4\n"}],
|
|
['blanks-13', '-t', '3,4', {IN=> "0 4\n"}, {OUT=> "0\t\t4\n"}],
|
|
|
|
# It is debatable whether this test should require an environment
|
|
# setting of e.g., _POSIX2_VERSION=1.
|
|
['obs-ovflo', '-18446744073709551617', {IN=>''}, {OUT=>''},
|
|
{EXIT => 1}, {ERR => "$prog: tab stop value is too large\n"}],
|
|
);
|
|
|
|
my $save_temps = $ENV{DEBUG};
|
|
my $verbose = $ENV{VERBOSE};
|
|
|
|
my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
|
|
exit $fail;
|