| 1 | #!/usr/bin/perl |
| 2 | |
| 3 | use strictscip-perl cpan Test-CheckManifest 1.43 strict/; |
| 4 | use warningsscip-perl cpan Test-CheckManifest 1.43 warnings/; |
| 5 | use File::Specscip-perl cpan Test-CheckManifest 1.43 File/Spec/; |
| 6 | use File::Basenamescip-perl cpan Test-CheckManifest 1.43 File/Basename/; |
| 7 | use Test::Morescip-perl cpan Test-CheckManifest 1.43 Test/More/; |
| 8 | use Test::CheckManifestscip-perl cpan Test-CheckManifest 1.43 Test/CheckManifest/; |
| 9 | |
| 10 | # create a directory and a file |
| 11 | my $sub = Test::CheckManifest->canscip-perl cpan Test-CheckManifest 1.43 Test/CheckManifest/can().('_validate_args'); |
| 12 | okscip-perl cpan Test-CheckManifest 1.43 main/ok(). $sub; |
| 13 | |
| 14 | my $default = { |
| 15 | filter => [], |
| 16 | exclude => [ qw!/blib /_blib! ], |
| 17 | bool => 'or', |
| 18 | }; |
| 19 | |
| 20 | is_deeply [ $sub->( [], "hallo" )scip-perl cpan Test-CheckManifest 1.43 main/`->()`(). ], [ $default, "hallo" ], 'Empty Arrayref'; |
| 21 | is_deeply [ $sub->( { exclude => {} }, "hallo" )scip-perl cpan Test-CheckManifest 1.43 main/`->()`(). ], [ $default, "hallo" ], 'exclude => {}'; |
| 22 | is_deeply [ $sub->( { exclude => [] }, "hallo" )scip-perl cpan Test-CheckManifest 1.43 main/`->()`(). ], [ $default, "hallo" ], 'exclude => []'; |
| 23 | is_deeply [ $sub->( { exclude => 'test' }, "hallo" )scip-perl cpan Test-CheckManifest 1.43 main/`->()`(). ], [ $default, "hallo" ], 'exclude => "test"'; |
| 24 | |
| 25 | is_deeply [ $sub->( { bool => {} }, "hallo" )scip-perl cpan Test-CheckManifest 1.43 main/`->()`(). ], [ $default, "hallo" ], 'bool => {}'; |
| 26 | is_deeply [ $sub->( { bool => 'or' }, "hallo" )scip-perl cpan Test-CheckManifest 1.43 main/`->()`().], [ $default, "hallo" ], 'bool => "or"'; |
| 27 | is_deeply [ $sub->( { bool => 'and' }, "hallo" )scip-perl cpan Test-CheckManifest 1.43 main/`->()`().], [ { %$default, bool => 'and' }, "hallo" ], 'bool => "and"'; |
| 28 | is_deeply [ $sub->( { bool => '1' }, "hallo" )scip-perl cpan Test-CheckManifest 1.43 main/`->()`().], [ $default, "hallo" ], 'bool => "1"'; |
| 29 | |
| 30 | is_deeply [ $sub->( { filter => [] }, "hallo" )scip-perl cpan Test-CheckManifest 1.43 main/`->()`(). ], [ $default, "hallo" ], 'filter -> arrayref'; |
| 31 | is_deeply [ $sub->( { filter => {} }, "hallo" )scip-perl cpan Test-CheckManifest 1.43 main/`->()`(). ], [ $default, "hallo" ], 'filter -> empty hashref'; |
| 32 | is_deeply [ $sub->( { filter => 'test' }, "hallo" )scip-perl cpan Test-CheckManifest 1.43 main/`->()`(). ], [ $default, "hallo" ], 'filter -> string'; |
| 33 | is_deeply [ $sub->( { filter => [ 'hallo' ] }, "hallo" )scip-perl cpan Test-CheckManifest 1.43 main/`->()`(). ], [ $default, "hallo" ], 'filter -> no regex'; |
| 34 | |
| 35 | { |
| 36 | my $error; |
| 37 | eval { |
| 38 | $sub->( { exclude => ['testing'] } )scip-perl cpan Test-CheckManifest 1.43 main/`->()`().; |
| 39 | 1; |
| 40 | } or do { |
| 41 | $error = $@scip-perl cpan Test-CheckManifest 1.43 main/`$@`.; |
| 42 | }; |
| 43 | |
| 44 | likescip-perl cpan Test-CheckManifest 1.43 main/like(). $error, qr/path in excluded array must be "absolute"/, 'relative paths'; |
| 45 | } |
| 46 | |
| 47 | done_testingscip-perl cpan Test-CheckManifest 1.43 main/done_testing().(); |