Skip to content

Commit

Permalink
t/unstow.t: move final set of tests into a subtest
Browse files Browse the repository at this point in the history
  • Loading branch information
aspiers committed Apr 7, 2024
1 parent c0b8890 commit 94ed916
Showing 1 changed file with 22 additions and 25 deletions.
47 changes: 22 additions & 25 deletions t/unstow.t
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use warnings;

use File::Spec qw(make_path);
use POSIX qw(getcwd);
use Test::More tests => 49;
use Test::More tests => 35;
use Test::Output;
use English qw(-no_match_vars);

Expand Down Expand Up @@ -465,12 +465,6 @@ subtests("unstow a simple tree minimally with absolute stow AND target dirs when
);
});

#
# unstow a tree with no-folding enabled -
# no refolding should take place
#
cd("$TEST_DIR/target");

sub create_and_stow_pkg {
my ($id, $pkg) = @_;

Expand Down Expand Up @@ -527,25 +521,28 @@ sub create_and_stow_pkg {
"../../$stow_pkg/$id-shared2/subdir/file-$pkg");
}

foreach my $pkg (qw{a b}) {
create_and_stow_pkg('no-folding', $pkg);
}
subtest("unstow a tree with no-folding enabled - no refolding should take place", sub {
cd("$TEST_DIR/target");
plan tests => 15;

my $stow = new_Stow('no-folding' => 1);
$stow->plan_unstow('no-folding-b');
is_deeply([ $stow->get_conflicts ], [] => 'no conflicts with --no-folding');
use Data::Dumper;
#warn Dumper($stow->get_tasks);

$stow->process_tasks();

is_nonexistent_path('no-folding-b-only-folded');
is_nonexistent_path('no-folding-b-only-folded2');
is_nonexistent_path('no-folding-b-only-unfolded/file-b');
is_nonexistent_path('no-folding-b-only-unfolded2/subdir/file-b');
is_dir_not_symlink('no-folding-shared');
is_dir_not_symlink('no-folding-shared2');
is_dir_not_symlink('no-folding-shared2/subdir');
foreach my $pkg (qw{a b}) {
create_and_stow_pkg('no-folding', $pkg);
}

my $stow = new_Stow('no-folding' => 1);
$stow->plan_unstow('no-folding-b');
is_deeply([ $stow->get_conflicts ], [] => 'no conflicts with --no-folding');

$stow->process_tasks();

is_nonexistent_path('no-folding-b-only-folded');
is_nonexistent_path('no-folding-b-only-folded2');
is_nonexistent_path('no-folding-b-only-unfolded/file-b');
is_nonexistent_path('no-folding-b-only-unfolded2/subdir/file-b');
is_dir_not_symlink('no-folding-shared');
is_dir_not_symlink('no-folding-shared2');
is_dir_not_symlink('no-folding-shared2/subdir');
});

# subtests("Test cleaning up subdirs with --paranoid option", sub {
# TODO
Expand Down

0 comments on commit 94ed916

Please sign in to comment.