| 1 | #!/usr/bin/perl |
| 2 | |
| 3 | use strict; |
| 4 | use warnings; |
| 5 | |
| 6 | use Cwd; |
| 7 | use File::Spec; |
| 8 | use File::Basename; |
| 9 | use Test::CheckManifest; |
| 10 | use Test::More; |
| 11 | |
| 12 | # create a directory and a file |
| 13 | my $sub = Test::CheckManifest->can('_check_excludes'); |
| 14 | ok $sub; |
| 15 | |
| 16 | my $dir = Cwd::realpath( dirname __FILE__ ); |
| 17 | $dir =~ s{.t\z}{}; |
| 18 | |
| 19 | { |
| 20 | is_deeply $sub->( { exclude => ['testing'] }, $dir ), [], 'empty excludes'; |
| 21 | is_deeply $sub->( { exclude => ['/t'] }, $dir ), [ File::Spec->catdir( $dir, 't' ) ], 't directory'; |
| 22 | is_deeply $sub->( { exclude => ['/t'] }, '.' ), [ File::Spec->catdir( $dir, 't' ) ], 't directory - home: .'; |
| 23 | is_deeply $sub->( { exclude => ['/t2'] }, '.' ), [ ], 't2 directory, that does not exist'; |
| 24 | is_deeply $sub->( { exclude => [''] }, '' ), [ ], 'empty strings'; |
| 25 | is_deeply $sub->( { exclude => [undef] }, '' ), [ ], 'undef excluded path'; |
| 26 | |
| 27 | is_deeply $sub->( { exclude => undef }, '' ), [ ], 'exclude is undef'; |
| 28 | } |
| 29 | |
| 30 | done_testing(); |