summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-01-14 16:19:09 +0000
committerJim Meyering <jim@meyering.net>2003-01-14 16:19:09 +0000
commitcaf5671edc5f3610dc2fe2d78c0c6089ba98bff8 (patch)
treefdf1ae3de2f7afcfa74aaaac303bd483eeb4e468
parentfb056f448a2ce3a93621f5de3e7bd55e6ba155dd (diff)
downloadcoreutils-caf5671edc5f3610dc2fe2d78c0c6089ba98bff8.tar.xz
factor a little
-rwxr-xr-xtests/ls-2/tests23
1 files changed, 13 insertions, 10 deletions
diff --git a/tests/ls-2/tests b/tests/ls-2/tests
index c63c05e63..55a6fd56d 100755
--- a/tests/ls-2/tests
+++ b/tests/ls-2/tests
@@ -32,14 +32,19 @@ my $rmdir2 = {POST => sub {rmdir 'd/e' or die "d/e: $!\n";
my $slink_d = {PRE => sub {symlink '/', 'd' or die "d: $!\n";
$ENV{LS_COLORS}='ln=01;36:di=01;34:or=40;31;01'
}};
-my $exe_in_subdir =
- {PRE => sub { mkdir 'j', 0700 or die "creating j: $!\n";
- (open F, '>j/d') && close F or die "creating j/d: $!\n";
- chmod 0555, 'j/d' or die "making j/d executable: $!\n";
- $ENV{LS_COLORS}='ex=01;32'
- }};
my $unlink_d = {POST => sub {unlink 'd' or die "d: $!\n"}};
+sub make_j_d ()
+{
+ mkdir 'j', 0700 or die "creating j: $!\n";
+ (open F, '>j/d') && close F or die "creating j/d: $!\n";
+ chmod 0555, 'j/d' or die "making j/d executable: $!\n";
+}
+
+my $exe_in_subdir = {PRE => sub { make_j_d (); $ENV{LS_COLORS}='ex=01;32' }};
+my $remove_j = {POST => sub {unlink 'j/d' or die "j/d: $!\n";
+ rmdir 'j' or die "j: $!\n" }};
+
my $q_bell = {IN => {"q\a" => ''}};
my @Tests =
(
@@ -84,11 +89,9 @@ my @Tests =
# Test for a bug that was introduced in coreutils-4.5.4; fixed in 4.5.5.
# To demonstrate it, the file in question (with executable bit set)
# must not be a command line argument.
- ['color-exe', '--color=always j',
+ ['color-exe1', '--color=always j',
{OUT => "\e[0m\e[01;32md\e[0m\n\e[m"},
- $exe_in_subdir,
- {POST => sub {unlink 'j/d' or die "j/d: $!\n";
- rmdir 'j' or die "j: $!\n" }}],
+ $exe_in_subdir, $remove_j],
# From Stéphane Chazelas.
['no-a-isdir-b', 'no-dir d',