4 # Testing find_stowed_path()
12 use Test
::More tests
=> 6;
16 my $stow = new_Stow
(dir
=> "$OUT_DIR/stow");
19 [ $stow->find_stowed_path("$OUT_DIR/target/a/b/c", '../../../stow/a/b/c') ],
20 [ "$OUT_DIR/stow/a/b/c", "$OUT_DIR/stow", 'a' ]
24 cd
("$OUT_DIR/target");
25 $stow->set_stow_dir('../stow');
27 [ $stow->find_stowed_path('a/b/c','../../../stow/a/b/c') ],
28 [ '../stow/a/b/c', '../stow', 'a' ]
29 => 'from target directory'
34 $stow->set_stow_dir("$OUT_DIR/target/stow");
37 [ $stow->find_stowed_path("$OUT_DIR/target/a/b/c", '../../stow/a/b/c') ],
38 [ "$OUT_DIR/target/stow/a/b/c", "$OUT_DIR/target/stow", 'a' ]
39 => 'stow is subdir of target directory'
43 [ $stow->find_stowed_path("$OUT_DIR/target/a/b/c",'../../empty') ],
45 => 'target is not stowed'
48 make_dir
("$OUT_DIR/target/stow2");
49 make_file
("$OUT_DIR/target/stow2/.stow");
52 [ $stow->find_stowed_path("$OUT_DIR/target/a/b/c",'../../stow2/a/b/c') ],
53 [ "$OUT_DIR/target/stow2/a/b/c", "$OUT_DIR/target/stow2", 'a' ]
54 => q
(detect alternate stow directory
)
57 # Possible corner case with rogue symlink pointing to ancestor of
60 [ $stow->find_stowed_path("$OUT_DIR/target/a/b/c",'../../..') ],
62 => q
(corner case
- link points to ancestor of stow dir
)