Debian Codegraph @

t/07_is_in_dir.t

raw symbols SCIP
1 #!/usr/bin/env perl
2
3 use strictscip-perl cpan Test-CheckManifest 1.43 strict/;
4 use warningsscip-perl cpan Test-CheckManifest 1.43 warnings/;
5
6 use File::Basenamescip-perl cpan Test-CheckManifest 1.43 File/Basename/;
7 use File::Specscip-perl cpan Test-CheckManifest 1.43 File/Spec/;
8 use Test::Morescip-perl cpan Test-CheckManifest 1.43 Test/More/;
9 use Test::CheckManifestscip-perl cpan Test-CheckManifest 1.43 Test/CheckManifest/;
10
11 use Cwdscip-perl cpan Test-CheckManifest 1.43 Cwd/;
12
13 my $sub = Test::CheckManifest->canscip-perl cpan Test-CheckManifest 1.43 Test/CheckManifest/can().('_is_in_dir');
14 okscip-perl cpan Test-CheckManifest 1.43 main/ok(). $sub;
15
16 my $dir = Cwd::realpathscip-perl cpan Test-CheckManifest 1.43 Cwd/realpath().( dirnamescip-perl cpan Test-CheckManifest 1.43 main/dirname(). __FILE__scip-perl cpan Test-CheckManifest 1.43 main/__FILE__(). );
17 $dir =~ s{.t\z}{};
18 my $t_dir = File::Spec->catdirscip-perl cpan Test-CheckManifest 1.43 File/Spec/catdir().( $dir, 't' );
19 my $abs_t_file = File::Spec->rel2absscip-perl cpan Test-CheckManifest 1.43 File/Spec/rel2abs().( __FILE__scip-perl cpan Test-CheckManifest 1.43 main/__FILE__(). );
20
21 my @tests = (
22 [ '/t/test.txt', '/t', 1 ],
23 [ '/t/sub/test.txt', '/t', 1 ],
24 [ '/t/test.txt', '/t2', undef ],
25 [ '', '/t2', undef ],
26 [ '/t/test.txt', '', undef ],
27 [ undef, '', undef ],
28 [ undef, '/t', undef ],
29 [ undef, undef, undef ],
30 [ '/t/test.txt', undef, undef ],
31 [ '', undef, undef ],
32 [ '/t/sub/', '/t', 1 ],
33 [ '/t/sub/test', '/t/sub/', 1 ],
34 [ '/t/test', '/t/sub/', undef ],
35 [ __FILE__scip-perl cpan Test-CheckManifest 1.43 main/__FILE__()., dirnamescip-perl cpan Test-CheckManifest 1.43 main/dirname().( __FILE__scip-perl cpan Test-CheckManifest 1.43 main/__FILE__(). ), 1 ],
36 [ $abs_t_file, $t_dir, 1 ],
37 );
38
39 for my $test ( @tests ) {
40 my ($file, $excludes, $expected) = @{$test};
41 my $result = $sub->( scip-perl cpan Test-CheckManifest 1.43 main/`->()`().$file, [scip-perl cpan Test-CheckManifest 1.43 main/`->()`().$excludes] )scip-perl cpan Test-CheckManifest 1.43 main/`->()`().;
42
43 isscip-perl cpan Test-CheckManifest 1.43 main/is(). $result, $expected, sprintfscip-perl cpan Test-CheckManifest 1.43 main/sprintf(). "%s -> %s",
44 ( definedscip-perl cpan Test-CheckManifest 1.43 main/defined(). $file ? $file : '<undef>' ),
45 ( definedscip-perl cpan Test-CheckManifest 1.43 main/defined(). $excludes ? $excludes : '<undef>' );
46 }
47
48 done_testingscip-perl cpan Test-CheckManifest 1.43 main/done_testing().();