-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Joris Vankerschaver
committed
Oct 4, 2016
1 parent
c171ca8
commit 182acbb
Showing
5 changed files
with
171 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
#!/usr/local/bin/perl | ||
|
||
# | ||
# Test case for dotfiles special processing | ||
# | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use testutil; | ||
|
||
use Test::More tests => 6; | ||
use English qw(-no_match_vars); | ||
|
||
use testutil; | ||
|
||
init_test_dirs(); | ||
cd("$OUT_DIR/target"); | ||
|
||
my $stow; | ||
|
||
# | ||
# process a dotfile marked with 'dot' prefix | ||
# | ||
|
||
$stow = new_Stow(dir => '../stow', dotfiles => 1); | ||
|
||
make_dir('../stow/dotfiles'); | ||
make_file('../stow/dotfiles/dot-foo'); | ||
|
||
$stow->plan_stow('dotfiles'); | ||
$stow->process_tasks(); | ||
is( | ||
readlink('.foo'), | ||
'../stow/dotfiles/dot-foo', | ||
=> 'processed dotfile' | ||
); | ||
|
||
# | ||
# ensure that turning off dotfile processing links files as usual | ||
# | ||
|
||
$stow = new_Stow(dir => '../stow', dotfiles => 0); | ||
|
||
make_dir('../stow/dotfiles'); | ||
make_file('../stow/dotfiles/dot-foo'); | ||
|
||
$stow->plan_stow('dotfiles'); | ||
$stow->process_tasks(); | ||
is( | ||
readlink('dot-foo'), | ||
'../stow/dotfiles/dot-foo', | ||
=> 'unprocessed dotfile' | ||
); | ||
|
||
|
||
# | ||
# process folder marked with 'dot' prefix | ||
# | ||
|
||
$stow = new_Stow(dir => '../stow', dotfiles => 1); | ||
|
||
make_dir('../stow/dotfiles/dot-emacs'); | ||
make_file('../stow/dotfiles/dot-emacs/init.el'); | ||
|
||
$stow->plan_stow('dotfiles'); | ||
$stow->process_tasks(); | ||
is( | ||
readlink('.emacs'), | ||
'../stow/dotfiles/dot-emacs', | ||
=> 'processed dotfile folder' | ||
); | ||
|
||
# | ||
# corner case: paths that have a part in them that's just "$DOT_PREFIX" or | ||
# "$DOT_PREFIX." should not have that part expanded. | ||
# | ||
|
||
$stow = new_Stow(dir => '../stow', dotfiles => 1); | ||
|
||
make_dir('../stow/dotfiles'); | ||
make_file('../stow/dotfiles/dot-'); | ||
|
||
make_dir('../stow/dotfiles/dot-.'); | ||
make_file('../stow/dotfiles/dot-./foo'); | ||
|
||
$stow->plan_stow('dotfiles'); | ||
$stow->process_tasks(); | ||
is( | ||
readlink('dot-'), | ||
'../stow/dotfiles/dot-', | ||
=> 'processed dotfile' | ||
); | ||
is( | ||
readlink('dot-.'), | ||
'../stow/dotfiles/dot-.', | ||
=> 'unprocessed dotfile' | ||
); | ||
|
||
# | ||
# simple unstow scenario | ||
# | ||
|
||
$stow = new_Stow(dir => '../stow', dotfiles => 1); | ||
|
||
make_dir('../stow/dotfiles'); | ||
make_file('../stow/dotfiles/dot-bar'); | ||
make_link('.bar', '../stow/dotfiles/dot-bar'); | ||
|
||
$stow->plan_unstow('dotfiles'); | ||
$stow->process_tasks(); | ||
ok( | ||
$stow->get_conflict_count == 0 && | ||
-f '../stow/dotfiles/dot-bar' && ! -e '.bar' | ||
=> 'unstow a simple dotfile' | ||
); |