Improve conflict reporting
This commit is contained in:
parent
81da7be357
commit
3d414dc071
5 changed files with 125 additions and 58 deletions
|
@ -18,7 +18,7 @@ init_test_dirs();
|
|||
cd("$OUT_DIR/target");
|
||||
|
||||
my $stow;
|
||||
my @conflicts;
|
||||
my %conflicts;
|
||||
|
||||
# Note that each of the following tests use a distinct set of files
|
||||
|
||||
|
@ -84,9 +84,10 @@ make_file('bin4'); # this is a file but named like a directory
|
|||
make_dir('../stow/pkg4/bin4');
|
||||
make_file('../stow/pkg4/bin4/file4');
|
||||
$stow->plan_stow('pkg4');
|
||||
@conflicts = $stow->get_conflicts();
|
||||
%conflicts = $stow->get_conflicts();
|
||||
like(
|
||||
$conflicts[-1], qr(CONFLICT:.*existing target is neither a link nor a directory)
|
||||
$conflicts{stow}{pkg4}[-1],
|
||||
qr(existing target is neither a link nor a directory)
|
||||
=> 'link to new dir conflicts with existing non-directory'
|
||||
);
|
||||
|
||||
|
@ -99,9 +100,10 @@ make_dir('bin5');
|
|||
make_link('bin5/file5','../../empty');
|
||||
make_dir('../stow/pkg5/bin5/file5');
|
||||
$stow->plan_stow('pkg5');
|
||||
@conflicts = $stow->get_conflicts();
|
||||
%conflicts = $stow->get_conflicts();
|
||||
like(
|
||||
$conflicts[-1], qr(CONFLICT:.*not owned by stow)
|
||||
$conflicts{stow}{pkg5}[-1],
|
||||
qr(not owned by stow)
|
||||
=> 'target already exists but is not owned by stow'
|
||||
);
|
||||
|
||||
|
@ -134,9 +136,10 @@ make_link('bin7/node7','../../stow/pkg7a/bin7/node7');
|
|||
make_dir('../stow/pkg7b/bin7/node7');
|
||||
make_file('../stow/pkg7b/bin7/node7/file7');
|
||||
$stow->plan_stow('pkg7b');
|
||||
@conflicts = $stow->get_conflicts();
|
||||
%conflicts = $stow->get_conflicts();
|
||||
like(
|
||||
$conflicts[-1], qr(CONFLICT:.*existing target is stowed to a different package)
|
||||
$conflicts{stow}{pkg7b}[-1],
|
||||
qr(existing target is stowed to a different package)
|
||||
=> 'link to new dir conflicts with existing stowed non-directory'
|
||||
);
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ cd("$OUT_DIR/target");
|
|||
# Note that each of the following tests use a distinct set of files
|
||||
|
||||
my $stow;
|
||||
my @conflicts;
|
||||
my %conflicts;
|
||||
|
||||
#
|
||||
# unstow a simple tree minimally
|
||||
|
@ -106,9 +106,10 @@ make_dir('../stow/pkg5/bin5');
|
|||
make_link('bin5', '../not-stow');
|
||||
|
||||
$stow->plan_unstow('pkg5');
|
||||
@conflicts = $stow->get_conflicts;
|
||||
%conflicts = $stow->get_conflicts;
|
||||
like(
|
||||
$conflicts[-1], qr(CONFLICT:.*existing target is not owned by stow)
|
||||
$conflicts{unstow}{pkg5}[-1],
|
||||
qr(existing target is not owned by stow)
|
||||
=> q(existing link not owned by stow)
|
||||
);
|
||||
|
||||
|
@ -300,10 +301,11 @@ stderr_like(
|
|||
qr/There are no outstanding operations to perform/,
|
||||
'no tasks to process when unstowing pkg12 for third time'
|
||||
);
|
||||
@conflicts = $stow->get_conflicts;
|
||||
%conflicts = $stow->get_conflicts;
|
||||
ok(
|
||||
@conflicts == 1 &&
|
||||
$conflicts[0] =~ m!existing target is neither a link nor a directory: man12/man1/file12\.1!
|
||||
$stow->get_conflict_count == 1 &&
|
||||
$conflicts{unstow}{pkg12}[0]
|
||||
=~ m!existing target is neither a link nor a directory: man12/man1/file12\.1!
|
||||
=> 'unstow pkg12 for third time'
|
||||
);
|
||||
|
||||
|
@ -320,7 +322,7 @@ make_link("$OUT_DIR/target/bin13", '../stow/pkg13/bin13');
|
|||
$stow->plan_unstow('pkg13');
|
||||
$stow->process_tasks();
|
||||
ok(
|
||||
scalar($stow->get_conflicts) == 0 &&
|
||||
$stow->get_conflict_count == 0 &&
|
||||
-f "$OUT_DIR/stow/pkg13/bin13/file13" && ! -e "$OUT_DIR/target/bin13"
|
||||
=> 'unstow a simple tree'
|
||||
);
|
||||
|
|
|
@ -20,7 +20,7 @@ cd("$OUT_DIR/target");
|
|||
# Note that each of the following tests use a distinct set of files
|
||||
|
||||
my $stow;
|
||||
my @conflicts;
|
||||
my %conflicts;
|
||||
|
||||
#
|
||||
# unstow a simple tree minimally
|
||||
|
@ -111,7 +111,7 @@ $stow->plan_unstow('pkg5');
|
|||
# cause any conflicts.
|
||||
#
|
||||
#like(
|
||||
# $Conflicts[-1], qr(CONFLICT:.*can't unlink.*not owned by stow)
|
||||
# $Conflicts[-1], qr(can't unlink.*not owned by stow)
|
||||
# => q(existing link not owned by stow)
|
||||
#);
|
||||
ok(
|
||||
|
@ -307,10 +307,11 @@ stderr_like(
|
|||
qr/There are no outstanding operations to perform/,
|
||||
'no tasks to process when unstowing pkg12 for third time'
|
||||
);
|
||||
@conflicts = $stow->get_conflicts;
|
||||
%conflicts = $stow->get_conflicts;
|
||||
ok(
|
||||
@conflicts == 1 &&
|
||||
$conflicts[0] =~ m!existing target is neither a link nor a directory: man12/man1/file12\.1!
|
||||
$stow->get_conflict_count == 1 &&
|
||||
$conflicts{unstow}{pkg12}[0]
|
||||
=~ m!existing target is neither a link nor a directory: man12/man1/file12\.1!
|
||||
=> 'unstow pkg12 for third time'
|
||||
);
|
||||
|
||||
|
@ -327,7 +328,7 @@ make_link("$OUT_DIR/target/bin13", '../stow/pkg13/bin13');
|
|||
$stow->plan_unstow('pkg13');
|
||||
$stow->process_tasks();
|
||||
ok(
|
||||
scalar($stow->get_conflicts) == 0 &&
|
||||
$stow->get_conflict_count == 0 &&
|
||||
-f "$OUT_DIR/stow/pkg13/bin13/file13" && ! -e "$OUT_DIR/target/bin13"
|
||||
=> 'unstow a simple tree'
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue