Debian Codegraph @

t/01_selftest.t

raw symbols ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5 use File::Spec;
6 use File::Basename;
7 use Test::More;
8
9 eval { use Test::CheckManifest tests => 10 };
10 plan skip_all => "Test::CheckManifest required" if $@;
11
12 #$Test::CheckManifest::VERBOSE = 0;
13
14 # create a directory and a file
15 my $home = dirname(File::Spec->rel2abs($0));
16
17 my $dir = File::Spec->catdir($home,'.git');
18 my $dir2 = File::Spec->catdir($home,'test');
19 my $file1 = File::Spec->catfile($dir,'test.txt');
20 my $file2 = File::Spec->catfile($home,'test.svn');
21 my $file3 = File::Spec->catfile($dir2,'hallo.txt');
22
23
24 mkdir $dir;
25
26 my $fh;
27 open $fh ,'>',$file1 and close $fh;
28 open $fh ,'>',$file2 and close $fh;
29
30 Test::CheckManifest::_not_ok_manifest('expected: Manifest not ok');
31 ok_manifest({filter => [qr/\.(?:svn|git|build)/]},'Filter: \.(?:svn|git|build)');
32 Test::CheckManifest::_not_ok_manifest({exclude => ['/.git/']},'expected: Manifest not ok (Exclude /.git/)');
33
34 mkdir $dir2;
35 open $fh ,'>',$file3 and close $fh;
36 Test::CheckManifest::_not_ok_manifest({filter => [qr/\.svn/]},'Filter: \.svn');
37 Test::CheckManifest::_not_ok_manifest({exclude => ['/.git/']},'expected: Manifest not ok (Exclude /.git/) [2]');
38 Test::CheckManifest::_not_ok_manifest({filter => [qr/\.git/], exclude => ['/.git/']},'expected: Manifest not ok (exclude OR filter)');
39 Test::CheckManifest::_not_ok_manifest({filter => [qr/\.git/],
40 bool => 'and',
41 exclude => ['/t/test']}, 'filter AND exclude');
42
43 Test::CheckManifest::_not_ok_manifest({
44 filter => [qr/\.git|blib/],
45 exclude => ['/t/test'],
46 verbose => 1,
47 }, 'filter OR exclude - test.svn is missing in MANIFEST');
48
49 unlink $file2;
50
51 ok_manifest({
52 filter => [qr/\.(git|build)/],
53 exclude => ['/t/test'],
54 }, 'filter OR exclude');
55
56 unlink $file3;
57
58 ok_manifest({filter => [qr/\.git/, qr/\.svn/, qr/\.build/ ]},'Filter \.git or \.svn');
59
60 unlink $file1;
61 rmdir $dir;
62 rmdir $dir2;
63
64