Rename $OUT_DIR to $TEST_DIR

This is a more accurate reflection of what it is.
This commit is contained in:
Adam Spiers 2019-06-28 00:53:12 +01:00
parent 5f875009f8
commit ba48fd3908
14 changed files with 102 additions and 102 deletions

View file

@ -30,7 +30,7 @@ use Test::Output;
use English qw(-no_match_vars);
init_test_dirs();
cd("$OUT_DIR/target");
cd("$TEST_DIR/target");
# setup stow directory
make_dir('stow');

View file

@ -28,7 +28,7 @@ use English qw(-no_match_vars);
use testutil;
init_test_dirs();
cd("$OUT_DIR/target");
cd("$TEST_DIR/target");
my $stow;

View file

@ -32,15 +32,15 @@ init_test_dirs();
local @ARGV = (
'-v',
'-d', "$OUT_DIR/stow",
'-t', "$OUT_DIR/target",
'-d', "$TEST_DIR/stow",
'-t', "$TEST_DIR/target",
'dummy'
);
my ($options, $pkgs_to_delete, $pkgs_to_stow) = process_options();
is($options->{verbose}, 1, 'verbose option');
is($options->{dir}, "$OUT_DIR/stow", 'stow dir option');
is($options->{dir}, "$TEST_DIR/stow", 'stow dir option');
my $stow = new_Stow(%$options);
@ -101,12 +101,12 @@ is_deeply($options->{ignore}, [ qr(~\z), qr(\.#.*\z) ] => 'ignore temp files');
# Check that expansion not applied.
#
local @ARGV = (
"--target=$OUT_DIR/".'$HOME',
"--target=$TEST_DIR/".'$HOME',
'dummy'
);
make_dir("$OUT_DIR/".'$HOME');
make_dir("$TEST_DIR/".'$HOME');
($options, $pkgs_to_delete, $pkgs_to_stow) = process_options();
is($options->{target}, "$OUT_DIR/".'$HOME', 'no expansion');
remove_dir("$OUT_DIR/".'$HOME');
is($options->{target}, "$TEST_DIR/".'$HOME', 'no expansion');
remove_dir("$TEST_DIR/".'$HOME');
# vim:ft=perl

View file

@ -27,7 +27,7 @@ use testutil;
use Test::More tests => 4;
init_test_dirs();
cd("$OUT_DIR/target");
cd("$TEST_DIR/target");
my $stow;

View file

@ -30,7 +30,7 @@ use English qw(-no_match_vars);
use testutil;
init_test_dirs();
cd("$OUT_DIR/target");
cd("$TEST_DIR/target");
my $stow;

View file

@ -28,7 +28,7 @@ use Test::More tests => 10;
use English qw(-no_match_vars);
init_test_dirs();
cd("$OUT_DIR/target");
cd("$TEST_DIR/target");
my $stow;

View file

@ -28,15 +28,15 @@ use Test::More tests => 6;
init_test_dirs();
my $stow = new_Stow(dir => "$OUT_DIR/stow");
my $stow = new_Stow(dir => "$TEST_DIR/stow");
is_deeply(
[ $stow->find_stowed_path("$OUT_DIR/target/a/b/c", '../../../stow/a/b/c') ],
[ "$OUT_DIR/stow/a/b/c", "$OUT_DIR/stow", 'a' ]
[ $stow->find_stowed_path("$TEST_DIR/target/a/b/c", '../../../stow/a/b/c') ],
[ "$TEST_DIR/stow/a/b/c", "$TEST_DIR/stow", 'a' ]
=> 'from root'
);
cd("$OUT_DIR/target");
cd("$TEST_DIR/target");
$stow->set_stow_dir('../stow');
is_deeply(
[ $stow->find_stowed_path('a/b/c','../../../stow/a/b/c') ],
@ -46,33 +46,33 @@ is_deeply(
make_dir('stow');
cd('../..');
$stow->set_stow_dir("$OUT_DIR/target/stow");
$stow->set_stow_dir("$TEST_DIR/target/stow");
is_deeply(
[ $stow->find_stowed_path("$OUT_DIR/target/a/b/c", '../../stow/a/b/c') ],
[ "$OUT_DIR/target/stow/a/b/c", "$OUT_DIR/target/stow", 'a' ]
[ $stow->find_stowed_path("$TEST_DIR/target/a/b/c", '../../stow/a/b/c') ],
[ "$TEST_DIR/target/stow/a/b/c", "$TEST_DIR/target/stow", 'a' ]
=> 'stow is subdir of target directory'
);
is_deeply(
[ $stow->find_stowed_path("$OUT_DIR/target/a/b/c",'../../empty') ],
[ $stow->find_stowed_path("$TEST_DIR/target/a/b/c",'../../empty') ],
[ '', '', '' ]
=> 'target is not stowed'
);
make_dir("$OUT_DIR/target/stow2");
make_file("$OUT_DIR/target/stow2/.stow");
make_dir("$TEST_DIR/target/stow2");
make_file("$TEST_DIR/target/stow2/.stow");
is_deeply(
[ $stow->find_stowed_path("$OUT_DIR/target/a/b/c",'../../stow2/a/b/c') ],
[ "$OUT_DIR/target/stow2/a/b/c", "$OUT_DIR/target/stow2", 'a' ]
[ $stow->find_stowed_path("$TEST_DIR/target/a/b/c",'../../stow2/a/b/c') ],
[ "$TEST_DIR/target/stow2/a/b/c", "$TEST_DIR/target/stow2", 'a' ]
=> q(detect alternate stow directory)
);
# Possible corner case with rogue symlink pointing to ancestor of
# stow dir.
is_deeply(
[ $stow->find_stowed_path("$OUT_DIR/target/a/b/c",'../../..') ],
[ $stow->find_stowed_path("$TEST_DIR/target/a/b/c",'../../..') ],
[ '', '', '' ]
=> q(corner case - link points to ancestor of stow dir)
);

View file

@ -28,7 +28,7 @@ use Test::More tests => 4;
use English qw(-no_match_vars);
init_test_dirs();
cd("$OUT_DIR/target");
cd("$TEST_DIR/target");
my $stow = new_Stow(dir => '../stow');

View file

@ -29,7 +29,7 @@ use testutil;
use Stow::Util qw(join_paths);
init_test_dirs();
cd("$OUT_DIR/target");
cd("$TEST_DIR/target");
my $stow = new_Stow();

View file

@ -29,7 +29,7 @@ use testutil;
require 'stow';
# stowrc file used for testing.
my $RC_FILE = "$OUT_DIR/.stowrc";
my $RC_FILE = "$TEST_DIR/.stowrc";
# Take the safe route and cowardly refuse to continue if there's
# already a file at $RC_FILE.
if (-e $RC_FILE) {
@ -52,24 +52,24 @@ init_test_dirs();
#
local @ARGV = ('dummy');
$rc_contents = <<HERE;
-d $OUT_DIR/stow
--target $OUT_DIR/target
-d $TEST_DIR/stow
--target $TEST_DIR/target
HERE
make_file($RC_FILE, $rc_contents);
my ($options, $pkgs_to_delete, $pkgs_to_stow) = process_options();
is($options->{target}, "$OUT_DIR/target", "rc options different lines");
is($options->{dir}, "$OUT_DIR/stow", "rc options different lines");
is($options->{target}, "$TEST_DIR/target", "rc options different lines");
is($options->{dir}, "$TEST_DIR/stow", "rc options different lines");
#
# Test that scalar cli option overwrites conflicting stowrc option.
#
local @ARGV = ('-d', "$OUT_DIR/stow",'dummy');
local @ARGV = ('-d', "$TEST_DIR/stow",'dummy');
$rc_contents = <<HERE;
-d bad/path
HERE
make_file($RC_FILE, $rc_contents);
($options, $pkgs_to_delete, $pkgs_to_stow) = process_options();
is($options->{dir}, "$OUT_DIR/stow", "cli overwrite scalar rc option.");
is($options->{dir}, "$TEST_DIR/stow", "cli overwrite scalar rc option.");
#
# Test that list cli option merges with conflicting stowrc option.
@ -98,8 +98,8 @@ is_deeply($options->{defer}, [qr(\Ainfo), qr(\Aman)],
# Test environment variable expansion function.
#
# Basic expansion
is(expand_environment('$HOME/stow'), "$OUT_DIR/stow", 'expand $HOME');
is(expand_environment('${HOME}/stow'), "$OUT_DIR/stow", 'expand ${HOME}');
is(expand_environment('$HOME/stow'), "$TEST_DIR/stow", 'expand $HOME');
is(expand_environment('${HOME}/stow'), "$TEST_DIR/stow", 'expand ${HOME}');
delete $ENV{UNDEFINED}; # just in case
foreach my $var ('$UNDEFINED', '${UNDEFINED}') {
@ -144,9 +144,9 @@ $rc_contents = <<'HERE';
HERE
make_file($RC_FILE, $rc_contents);
($options, $pkgs_to_delete, $pkgs_to_stow) = get_config_file_options();
is($options->{dir}, "$OUT_DIR/stow",
is($options->{dir}, "$TEST_DIR/stow",
"apply environment expansion on stowrc --dir");
is($options->{target}, "$OUT_DIR/stow",
is($options->{target}, "$TEST_DIR/stow",
"apply environment expansion on stowrc --target");
is_deeply($options->{ignore}, [qr(\$HOME\z)],
"environment expansion not applied on --ignore");
@ -167,9 +167,9 @@ $rc_contents = <<'HERE';
HERE
make_file($RC_FILE, $rc_contents);
($options, $pkgs_to_delete, $pkgs_to_stow) = get_config_file_options();
is($options->{dir}, "$OUT_DIR/stow",
is($options->{dir}, "$TEST_DIR/stow",
"apply environment expansion on stowrc --dir");
is($options->{target}, "$OUT_DIR/stow",
is($options->{target}, "$TEST_DIR/stow",
"apply environment expansion on stowrc --target");
is_deeply($options->{ignore}, [qr(~/stow\z)],
"environment expansion not applied on --ignore");
@ -181,5 +181,5 @@ is_deeply($options->{override}, [qr(\A~/stow)],
# Clean up files used for testing.
#
unlink $RC_FILE or die "Unable to clean up $RC_FILE.\n";
remove_dir($OUT_DIR);
remove_dir($TEST_DIR);

View file

@ -30,7 +30,7 @@ use Stow::Util qw(canon_path);
use testutil;
init_test_dirs();
cd("$OUT_DIR/target");
cd("$TEST_DIR/target");
my $stow;
my %conflicts;
@ -400,16 +400,16 @@ uncapture_stderr();
# stow a simple tree minimally when cwd isn't target
#
cd('../..');
$stow = new_Stow(dir => "$OUT_DIR/stow", target => "$OUT_DIR/target");
$stow = new_Stow(dir => "$TEST_DIR/stow", target => "$TEST_DIR/target");
make_dir("$OUT_DIR/stow/pkg16/bin16");
make_file("$OUT_DIR/stow/pkg16/bin16/file16");
make_dir("$TEST_DIR/stow/pkg16/bin16");
make_file("$TEST_DIR/stow/pkg16/bin16/file16");
$stow->plan_stow('pkg16');
$stow->process_tasks();
is_deeply([ $stow->get_conflicts ], [], 'no conflicts with minimal stow');
is(
readlink("$OUT_DIR/target/bin16"),
readlink("$TEST_DIR/target/bin16"),
'../stow/pkg16/bin16',
=> "minimal stow of a simple tree when cwd isn't target"
);
@ -418,17 +418,17 @@ is(
# stow a simple tree minimally to absolute stow dir when cwd isn't
# target
#
$stow = new_Stow(dir => canon_path("$OUT_DIR/stow"),
target => "$OUT_DIR/target");
$stow = new_Stow(dir => canon_path("$TEST_DIR/stow"),
target => "$TEST_DIR/target");
make_dir("$OUT_DIR/stow/pkg17/bin17");
make_file("$OUT_DIR/stow/pkg17/bin17/file17");
make_dir("$TEST_DIR/stow/pkg17/bin17");
make_file("$TEST_DIR/stow/pkg17/bin17/file17");
$stow->plan_stow('pkg17');
$stow->process_tasks();
is_deeply([ $stow->get_conflicts ], [], 'no conflicts with minimal stow');
is(
readlink("$OUT_DIR/target/bin17"),
readlink("$TEST_DIR/target/bin17"),
'../stow/pkg17/bin17',
=> "minimal stow of a simple tree with absolute stow dir"
);
@ -437,17 +437,17 @@ is(
# stow a simple tree minimally with absolute stow AND target dirs when
# cwd isn't target
#
$stow = new_Stow(dir => canon_path("$OUT_DIR/stow"),
target => canon_path("$OUT_DIR/target"));
$stow = new_Stow(dir => canon_path("$TEST_DIR/stow"),
target => canon_path("$TEST_DIR/target"));
make_dir("$OUT_DIR/stow/pkg18/bin18");
make_file("$OUT_DIR/stow/pkg18/bin18/file18");
make_dir("$TEST_DIR/stow/pkg18/bin18");
make_file("$TEST_DIR/stow/pkg18/bin18/file18");
$stow->plan_stow('pkg18');
$stow->process_tasks();
is_deeply([ $stow->get_conflicts ], [], 'no conflicts with minimal stow');
is(
readlink("$OUT_DIR/target/bin18"),
readlink("$TEST_DIR/target/bin18"),
'../stow/pkg18/bin18',
=> "minimal stow of a simple tree with absolute stow and target dirs"
);
@ -458,7 +458,7 @@ is(
# folded directories should be split open (unfolded) where
# (and only where) necessary
#
cd("$OUT_DIR/target");
cd("$TEST_DIR/target");
sub create_pkg {
my ($id, $pkg) = @_;

View file

@ -36,7 +36,7 @@ use Stow::Util qw(parent canon_path);
use base qw(Exporter);
our @EXPORT = qw(
$OUT_DIR
$TEST_DIR
$stderr
init_test_dirs
cd
@ -48,7 +48,7 @@ our @EXPORT = qw(
capture_stderr uncapture_stderr
);
our $OUT_DIR = 'tmp-testing-trees';
our $TEST_DIR = 'tmp-testing-trees';
our $stderr;
my $tied_err;
@ -64,13 +64,13 @@ sub uncapture_stderr {
}
sub init_test_dirs {
for my $dir ("$OUT_DIR/target", "$OUT_DIR/stow") {
for my $dir ("$TEST_DIR/target", "$TEST_DIR/stow") {
-d $dir and remove_tree($dir);
make_dir($dir);
}
# Don't let user's ~/.stow-global-ignore affect test results
$ENV{HOME} = $OUT_DIR;
$ENV{HOME} = $TEST_DIR;
}
sub new_Stow {

View file

@ -30,7 +30,7 @@ use testutil;
use Stow::Util qw(canon_path);
init_test_dirs();
cd("$OUT_DIR/target");
cd("$TEST_DIR/target");
# Note that each of the following tests use a distinct set of files
@ -279,8 +279,8 @@ ok(
# Unstow a never stowed package
#
eval { remove_dir("$OUT_DIR/target"); };
mkdir("$OUT_DIR/target");
eval { remove_dir("$TEST_DIR/target"); };
mkdir("$TEST_DIR/target");
$stow = new_Stow();
$stow->plan_unstow('pkg12');
@ -310,17 +310,17 @@ ok(
# unstow a simple tree minimally when cwd isn't target
#
cd('../..');
$stow = new_Stow(dir => "$OUT_DIR/stow", target => "$OUT_DIR/target");
$stow = new_Stow(dir => "$TEST_DIR/stow", target => "$TEST_DIR/target");
make_dir("$OUT_DIR/stow/pkg13/bin13");
make_file("$OUT_DIR/stow/pkg13/bin13/file13");
make_link("$OUT_DIR/target/bin13", '../stow/pkg13/bin13');
make_dir("$TEST_DIR/stow/pkg13/bin13");
make_file("$TEST_DIR/stow/pkg13/bin13/file13");
make_link("$TEST_DIR/target/bin13", '../stow/pkg13/bin13');
$stow->plan_unstow('pkg13');
$stow->process_tasks();
ok(
$stow->get_conflict_count == 0 &&
-f "$OUT_DIR/stow/pkg13/bin13/file13" && ! -e "$OUT_DIR/target/bin13"
-f "$TEST_DIR/stow/pkg13/bin13/file13" && ! -e "$TEST_DIR/target/bin13"
=> 'unstow a simple tree'
);
@ -328,18 +328,18 @@ ok(
# unstow a simple tree minimally with absolute stow dir when cwd isn't
# target
#
$stow = new_Stow(dir => canon_path("$OUT_DIR/stow"),
target => "$OUT_DIR/target");
$stow = new_Stow(dir => canon_path("$TEST_DIR/stow"),
target => "$TEST_DIR/target");
make_dir("$OUT_DIR/stow/pkg14/bin14");
make_file("$OUT_DIR/stow/pkg14/bin14/file14");
make_link("$OUT_DIR/target/bin14", '../stow/pkg14/bin14');
make_dir("$TEST_DIR/stow/pkg14/bin14");
make_file("$TEST_DIR/stow/pkg14/bin14/file14");
make_link("$TEST_DIR/target/bin14", '../stow/pkg14/bin14');
$stow->plan_unstow('pkg14');
$stow->process_tasks();
ok(
$stow->get_conflict_count == 0 &&
-f "$OUT_DIR/stow/pkg14/bin14/file14" && ! -e "$OUT_DIR/target/bin14"
-f "$TEST_DIR/stow/pkg14/bin14/file14" && ! -e "$TEST_DIR/target/bin14"
=> 'unstow a simple tree with absolute stow dir'
);
@ -347,18 +347,18 @@ ok(
# unstow a simple tree minimally with absolute stow AND target dirs
# when cwd isn't target
#
$stow = new_Stow(dir => canon_path("$OUT_DIR/stow"),
target => canon_path("$OUT_DIR/target"));
$stow = new_Stow(dir => canon_path("$TEST_DIR/stow"),
target => canon_path("$TEST_DIR/target"));
make_dir("$OUT_DIR/stow/pkg15/bin15");
make_file("$OUT_DIR/stow/pkg15/bin15/file15");
make_link("$OUT_DIR/target/bin15", '../stow/pkg15/bin15');
make_dir("$TEST_DIR/stow/pkg15/bin15");
make_file("$TEST_DIR/stow/pkg15/bin15/file15");
make_link("$TEST_DIR/target/bin15", '../stow/pkg15/bin15');
$stow->plan_unstow('pkg15');
$stow->process_tasks();
ok(
$stow->get_conflict_count == 0 &&
-f "$OUT_DIR/stow/pkg15/bin15/file15" && ! -e "$OUT_DIR/target/bin15"
-f "$TEST_DIR/stow/pkg15/bin15/file15" && ! -e "$TEST_DIR/target/bin15"
=> 'unstow a simple tree with absolute stow and target dirs'
);
@ -366,7 +366,7 @@ ok(
# unstow a tree with no-folding enabled -
# no refolding should take place
#
cd("$OUT_DIR/target");
cd("$TEST_DIR/target");
sub create_and_stow_pkg {
my ($id, $pkg) = @_;

View file

@ -30,7 +30,7 @@ use testutil;
use Stow::Util qw(canon_path);
init_test_dirs();
cd("$OUT_DIR/target");
cd("$TEST_DIR/target");
# Note that each of the following tests use a distinct set of files
@ -308,8 +308,8 @@ check_protected_dirs_skipped();
# Unstow a never stowed package
#
eval { remove_dir("$OUT_DIR/target"); };
mkdir("$OUT_DIR/target");
eval { remove_dir("$TEST_DIR/target"); };
mkdir("$TEST_DIR/target");
$stow = new_compat_Stow();
capture_stderr();
@ -343,17 +343,17 @@ check_protected_dirs_skipped();
# unstow a simple tree minimally when cwd isn't target
#
cd('../..');
$stow = new_Stow(dir => "$OUT_DIR/stow", target => "$OUT_DIR/target");
$stow = new_Stow(dir => "$TEST_DIR/stow", target => "$TEST_DIR/target");
make_dir("$OUT_DIR/stow/pkg13/bin13");
make_file("$OUT_DIR/stow/pkg13/bin13/file13");
make_link("$OUT_DIR/target/bin13", '../stow/pkg13/bin13');
make_dir("$TEST_DIR/stow/pkg13/bin13");
make_file("$TEST_DIR/stow/pkg13/bin13/file13");
make_link("$TEST_DIR/target/bin13", '../stow/pkg13/bin13');
$stow->plan_unstow('pkg13');
$stow->process_tasks();
ok(
$stow->get_conflict_count == 0 &&
-f "$OUT_DIR/stow/pkg13/bin13/file13" && ! -e "$OUT_DIR/target/bin13"
-f "$TEST_DIR/stow/pkg13/bin13/file13" && ! -e "$TEST_DIR/target/bin13"
=> 'unstow a simple tree'
);
@ -361,18 +361,18 @@ ok(
# unstow a simple tree minimally with absolute stow dir when cwd isn't
# target
#
$stow = new_Stow(dir => canon_path("$OUT_DIR/stow"),
target => "$OUT_DIR/target");
$stow = new_Stow(dir => canon_path("$TEST_DIR/stow"),
target => "$TEST_DIR/target");
make_dir("$OUT_DIR/stow/pkg14/bin14");
make_file("$OUT_DIR/stow/pkg14/bin14/file14");
make_link("$OUT_DIR/target/bin14", '../stow/pkg14/bin14');
make_dir("$TEST_DIR/stow/pkg14/bin14");
make_file("$TEST_DIR/stow/pkg14/bin14/file14");
make_link("$TEST_DIR/target/bin14", '../stow/pkg14/bin14');
$stow->plan_unstow('pkg14');
$stow->process_tasks();
ok(
$stow->get_conflict_count == 0 &&
-f "$OUT_DIR/stow/pkg14/bin14/file14" && ! -e "$OUT_DIR/target/bin14"
-f "$TEST_DIR/stow/pkg14/bin14/file14" && ! -e "$TEST_DIR/target/bin14"
=> 'unstow a simple tree with absolute stow dir'
);
@ -380,18 +380,18 @@ ok(
# unstow a simple tree minimally with absolute stow AND target dirs
# when cwd isn't target
#
$stow = new_Stow(dir => canon_path("$OUT_DIR/stow"),
target => canon_path("$OUT_DIR/target"));
$stow = new_Stow(dir => canon_path("$TEST_DIR/stow"),
target => canon_path("$TEST_DIR/target"));
make_dir("$OUT_DIR/stow/pkg15/bin15");
make_file("$OUT_DIR/stow/pkg15/bin15/file15");
make_link("$OUT_DIR/target/bin15", '../stow/pkg15/bin15');
make_dir("$TEST_DIR/stow/pkg15/bin15");
make_file("$TEST_DIR/stow/pkg15/bin15/file15");
make_link("$TEST_DIR/target/bin15", '../stow/pkg15/bin15');
$stow->plan_unstow('pkg15');
$stow->process_tasks();
ok(
$stow->get_conflict_count == 0 &&
-f "$OUT_DIR/stow/pkg15/bin15/file15" && ! -e "$OUT_DIR/target/bin15"
-f "$TEST_DIR/stow/pkg15/bin15/file15" && ! -e "$TEST_DIR/target/bin15"
=> 'unstow a simple tree with absolute stow and target dirs'
);