1
0
mirror of https://git.savannah.gnu.org/git/coreutils.git synced 2025-08-08 18:22:09 +03:00

tests: remove directory, tests/head/

* configure.ac (AC_CONFIG_FILES): Remove tests/head/Makefile.
* tests/Makefile.am (SUBDIRS): Remove head.
* tests/misc/head: New file, derived from ...
* tests/head/Test.pm: ...this.  Remove file.
* tests/head/in: Remove file.
* tests/head/in-1024: Remove file.
* tests/Coreutils.pm (triple_test): New function.
This commit is contained in:
Jim Meyering
2008-05-04 11:38:31 +02:00
parent 5ad6145142
commit bc2b9e04e9
7 changed files with 134 additions and 139 deletions

View File

@@ -25,7 +25,7 @@ use File::Compare qw(compare);
@ISA = qw(Exporter);
($VERSION = '$Revision: 1.5 $ ') =~ tr/[0-9].//cd;
@EXPORT = qw (run_tests);
@EXPORT = qw (run_tests triple_test);
my $debug = $ENV{DEBUG};
@@ -562,5 +562,46 @@ sub run_tests ($$$$$)
return $fail;
}
# For each test in @$TESTS, generate two additional tests,
# one using stdin, the other using a pipe. I.e., given this one
# ['idem-0', {IN=>''}, {OUT=>''}],
# generate these:
# ['idem-0.r', '<', {IN=>''}, {OUT=>''}],
# ['idem-0.p', {IN_PIPE=>''}, {OUT=>''}],
# Generate new tests only if there is exactly one input spec.
# The returned list of tests contains each input test, followed
# by zero or two derived tests.
sub triple_test($)
{
my ($tests) = @_;
my @new;
foreach my $t (@$tests)
{
push @new, $t;
my @in;
my @args;
my @list_of_hash;
foreach my $e (@$t)
{
!ref $e
and push (@args, $e), next;
ref $e && ref $e eq 'HASH'
or (warn "$0: $t->[0]: unexpected entry type\n"), next;
defined $e->{IN}
and (push @in, $e->{IN}), next;
push @list_of_hash, $e;
}
# Add variants IFF there is exactly one input file.
@in == 1
or next;
shift @args; # discard test name
push @new, ["$t->[0].r", @args, '<', {IN => $in[0]}, @list_of_hash];
push @new, ["$t->[0].p", @args, {IN_PIPE => $in[0]}, @list_of_hash];
}
return @new;
}
## package return
1;