add unit tests for adjust_dotfiles()
This commit is contained in:
parent
2f762e3908
commit
8c09d41054
1 changed files with 22 additions and 3 deletions
25
t/dotfiles.t
25
t/dotfiles.t
|
@ -22,16 +22,35 @@
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
use testutil;
|
||||
|
||||
use Test::More tests => 10;
|
||||
use Test::More tests => 11;
|
||||
use English qw(-no_match_vars);
|
||||
|
||||
use Stow::Util qw(adjust_dotfile);
|
||||
use testutil;
|
||||
|
||||
init_test_dirs();
|
||||
cd("$TEST_DIR/target");
|
||||
|
||||
subtest('adjust_dotfile()', sub {
|
||||
plan tests => 9;
|
||||
my @TESTS = (
|
||||
['file'],
|
||||
['dot-file', '.file'],
|
||||
['dir1/file'],
|
||||
['dir1/dir2/file'],
|
||||
['dir1/dir2/dot-file', 'dir1/dir2/.file'],
|
||||
['dir1/dot-dir2/file', 'dir1/.dir2/file'],
|
||||
['dir1/dot-dir2/dot-file', 'dir1/.dir2/.file'],
|
||||
['dot-dir1/dot-dir2/dot-file', '.dir1/.dir2/.file'],
|
||||
['dot-dir1/dot-dir2/file', '.dir1/.dir2/file'],
|
||||
);
|
||||
for my $test (@TESTS) {
|
||||
my ($input, $expected) = @$test;
|
||||
$expected ||= $input;
|
||||
is(adjust_dotfile($input), $expected);
|
||||
}
|
||||
});
|
||||
|
||||
my $stow;
|
||||
|
||||
#
|
||||
|
|
Loading…
Reference in a new issue