12 use Test
::More tests
=> 4;
13 use English
qw(-no_match_vars);
16 cd
("$OUT_DIR/target");
18 my $stow = new_Stow
(dir
=> '../stow');
20 # Note that each of the following tests use a distinct set of files
23 # can fold a simple tree
26 make_dir
('../stow/pkg1/bin1');
27 make_file
('../stow/pkg1/bin1/file1');
29 make_link
('bin1/file1','../../stow/pkg1/bin1/file1');
31 is
( $stow->foldable('bin1'), '../stow/pkg1/bin1' => q
(can fold a simple tree
) );
34 # can't fold an empty directory
37 make_dir
('../stow/pkg2/bin2');
38 make_file
('../stow/pkg2/bin2/file2');
41 is
( $stow->foldable('bin2'), '' => q
(can
't fold an empty directory) );
44 # can't fold
if dir contains a non
-link
47 make_dir
('../stow/pkg3/bin3');
48 make_file
('../stow/pkg3/bin3/file3');
50 make_link
('bin3/file3','../../stow/pkg3/bin3/file3');
51 make_file
('bin3/non-link');
53 is
( $stow->foldable('bin3'), '' => q
(can
't fold a dir containing non-links) );
56 # can't fold
if links point to different directories
60 make_dir
('../stow/pkg4a/bin4');
61 make_file
('../stow/pkg4a/bin4/file4a');
62 make_link
('bin4/file4a','../../stow/pkg4a/bin4/file4a');
63 make_dir
('../stow/pkg4b/bin4');
64 make_file
('../stow/pkg4b/bin4/file4b');
65 make_link
('bin4/file4b','../../stow/pkg4b/bin4/file4b');
67 is
( $stow->foldable('bin4'), '' => q
(can
't fold if links point to different dirs) );