diff --git a/t/dotfiles.t b/t/dotfiles.t index 2116f90..6f0f583 100755 --- a/t/dotfiles.t +++ b/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; #