Test unstowing when target contains a real file generates a conflict.

This commit is contained in:
Adam Spiers 2011-11-18 11:24:36 +00:00
parent 6e7ed071c1
commit fbe547c132
2 changed files with 38 additions and 2 deletions

View file

@ -7,7 +7,7 @@
# load as a library # load as a library
BEGIN { use lib qw(.); require "t/util.pm"; require "stow"; } BEGIN { use lib qw(.); require "t/util.pm"; require "stow"; }
use Test::More tests => 18; use Test::More tests => 20;
use Test::Output; use Test::Output;
use English qw(-no_match_vars); use English qw(-no_match_vars);
@ -296,6 +296,24 @@ ok(
=> 'unstow never stowed package pkg12' => 'unstow never stowed package pkg12'
); );
#
# Unstowing when target contains a real file shouldn't be an issue.
#
make_file('man12/man1/file12.1');
reset_state();
unstow_contents('../stow/pkg12', '.');
stderr_like(
sub { process_tasks(); },
qr/There are no outstanding operations to perform/,
'no tasks to process when unstowing pkg12 for third time'
);
ok(
scalar(@Conflicts) == 1 &&
$Conflicts[0] =~ m!existing target is neither a link nor a directory: man12/man1/file12\.1!
=> 'unstow pkg12 for third time'
);
# Todo # Todo
# #

View file

@ -7,7 +7,7 @@
# load as a library # load as a library
BEGIN { use lib qw(.); require "t/util.pm"; require "stow"; } BEGIN { use lib qw(.); require "t/util.pm"; require "stow"; }
use Test::More tests => 18; use Test::More tests => 20;
use Test::Output; use Test::Output;
use English qw(-no_match_vars); use English qw(-no_match_vars);
@ -300,6 +300,24 @@ ok(
=> 'unstow never stowed package pkg12' => 'unstow never stowed package pkg12'
); );
#
# Unstowing when target contains a real file shouldn't be an issue.
#
make_file('man12/man1/file12.1');
reset_state();
unstow_contents('../stow/pkg12', '.');
stderr_like(
sub { process_tasks(); },
qr/There are no outstanding operations to perform/,
'no tasks to process when unstowing pkg12 for third time'
);
ok(
scalar(@Conflicts) == 1 &&
$Conflicts[0] =~ m!existing target is neither a link nor a directory: man12/man1/file12\.1!
=> 'unstow pkg12 for third time'
);
# Todo # Todo
# #