File: 04_check_excludes.t

package info (click to toggle)
libtest-checkmanifest-perl 1.43-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 236 kB
  • sloc: perl: 773; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 938 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/perl

use strict;
use warnings;

use Cwd;
use File::Spec;
use File::Basename;
use Test::CheckManifest;
use Test::More;

# create a directory and a file
my $sub = Test::CheckManifest->can('_check_excludes');
ok $sub;

my $dir = Cwd::realpath( dirname __FILE__ );
$dir    =~ s{.t\z}{};

{
    is_deeply $sub->( { exclude => ['testing'] }, $dir ), [], 'empty excludes';
    is_deeply $sub->( { exclude => ['/t'] }, $dir ), [ File::Spec->catdir( $dir, 't' ) ], 't directory';
    is_deeply $sub->( { exclude => ['/t'] }, '.' ), [ File::Spec->catdir( $dir, 't' ) ], 't directory - home: .';
    is_deeply $sub->( { exclude => ['/t2'] }, '.' ), [ ], 't2 directory, that does not exist';
    is_deeply $sub->( { exclude => [''] }, '' ), [ ], 'empty strings';
    is_deeply $sub->( { exclude => [undef] }, '' ), [ ], 'undef excluded path';

    is_deeply $sub->( { exclude => undef }, '' ), [ ], 'exclude is undef';
}

done_testing();