| 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 | local $ENVscip-perl cpan Test-CheckManifest 1.43 main/`%ENV`.{NO_MANIFEST_CHECK} = 1; |
| 14 | |
| 15 | my $sub = Test::CheckManifest->canscip-perl cpan Test-CheckManifest 1.43 Test/CheckManifest/can().('_check_manifest'); |
| 16 | okscip-perl cpan Test-CheckManifest 1.43 main/ok(). $sub; |
| 17 | |
| 18 | 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__(). ); |
| 19 | $dir =~ s{.t\z}{}; |
| 20 | my $t_dir = File::Spec->catdirscip-perl cpan Test-CheckManifest 1.43 File/Spec/catdir().( $dir, 't' ); |
| 21 | 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__(). ); |
| 22 | |
| 23 | # my ($existing_files, $manifest_files, $excluded, $msg) = @_; |
| 24 | |
| 25 | my $diag = ''; |
| 26 | { |
| 27 | no warnings 'redefine'; |
| 28 | sub Test::Builder::diagscip-perl cpan Test-CheckManifest 1.43 main/`Test::Builder::diag`(). { |
| 29 | $diag .= $_scip-perl cpan Test-CheckManifest 1.43 main/`@_`.[1] . "\n"; |
| 30 | }; |
| 31 | } |
| 32 | |
| 33 | my $cnt = 0; |
| 34 | |
| 35 | { |
| 36 | my @tests = ( |
| 37 | [ undef, undef, undef, 'test', 1 ], |
| 38 | [ ['/t/test'], undef, undef, 'test', '' ], |
| 39 | [ ['/t/test'], ['/t/test'], undef, 'test', 1 ], |
| 40 | [ ['/t/test'], undef, {'/t/test' => 1}, 'test', 1 ], |
| 41 | [ ['/t/test'], ['/test'], {'/t/test' => 1}, 'test', '' ], |
| 42 | [ ['/t/test'], ['/t/test', '/t/test'], undef, 'test', '' ], |
| 43 | [ ['/t/test','/t/test2'], ['/t/test'], undef, 'test', '' ], |
| 44 | ); |
| 45 | |
| 46 | for my $test ( @tests ) { |
| 47 | $diag = ''; |
| 48 | |
| 49 | my @params = @{$test}; |
| 50 | my $expected = popscip-perl cpan Test-CheckManifest 1.43 main/pop(). @params; |
| 51 | |
| 52 | my $result = $sub->( scip-perl cpan Test-CheckManifest 1.43 main/`->()`().@params, 'No Manifest' )scip-perl cpan Test-CheckManifest 1.43 main/`->()`().; |
| 53 | |
| 54 | isscip-perl cpan Test-CheckManifest 1.43 main/is(). $result, $expected, "Test $cnt"; |
| 55 | |
| 56 | $cnt++; |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | { |
| 61 | local $Test::CheckManifest::test_boolscip-perl cpan Test-CheckManifest 1.43 Test/CheckManifest/$test_bool. = 0; |
| 62 | my @tests = ( |
| 63 | [ undef, undef, undef, 'test', '' ], |
| 64 | [ ['/t/test'], undef, undef, 'test', 1 ], |
| 65 | [ ['/t/test'], ['/t/test'], undef, 'test', '' ], |
| 66 | [ ['/t/test'], undef, {'/t/test' => 1}, 'test', '' ], |
| 67 | [ ['/t/test'], ['/test'], {'/t/test' => 1}, 'test', 1 ], |
| 68 | [ ['/t/test'], ['/t/test', '/t/test'], undef, 'test', 1 ], |
| 69 | [ ['/t/test','/t/test2'], ['/t/test'], undef, 'test', 1 ], |
| 70 | ); |
| 71 | |
| 72 | for my $test ( @tests ) { |
| 73 | $diag = ''; |
| 74 | |
| 75 | my @params = @{$test}; |
| 76 | my $expected = popscip-perl cpan Test-CheckManifest 1.43 main/pop(). @params; |
| 77 | |
| 78 | my $result = $sub->( scip-perl cpan Test-CheckManifest 1.43 main/`->()`().@params, 'No Manifest' )scip-perl cpan Test-CheckManifest 1.43 main/`->()`().; |
| 79 | |
| 80 | isscip-perl cpan Test-CheckManifest 1.43 main/is(). $result, $expected; |
| 81 | $cnt++; |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | { |
| 86 | local $Test::CheckManifest::test_boolscip-perl cpan Test-CheckManifest 1.43 Test/CheckManifest/$test_bool. = 0; |
| 87 | local $Test::CheckManifest::VERBOSEscip-perl cpan Test-CheckManifest 1.43 Test/CheckManifest/$VERBOSE. = 0; |
| 88 | my @tests = ( |
| 89 | [ undef, undef, undef, 'test', '' ], |
| 90 | [ ['/t/test'], undef, undef, 'test', 1 ], |
| 91 | [ ['/t/test'], ['/t/test'], undef, 'test', '' ], |
| 92 | [ ['/t/test'], undef, {'/t/test' => 1}, 'test', '' ], |
| 93 | [ ['/t/test'], ['/test'], {'/t/test' => 1}, 'test', 1 ], |
| 94 | [ ['/t/test'], ['/t/test', '/t/test'], undef, 'test', 1 ], |
| 95 | [ ['/t/test','/t/test2'], ['/t/test'], undef, 'test', 1 ], |
| 96 | ); |
| 97 | |
| 98 | for my $test ( @tests ) { |
| 99 | $diag = ''; |
| 100 | |
| 101 | my @params = @{$test}; |
| 102 | my $expected = popscip-perl cpan Test-CheckManifest 1.43 main/pop(). @params; |
| 103 | |
| 104 | my $result = $sub->( scip-perl cpan Test-CheckManifest 1.43 main/`->()`().@params, 'No Manifest' )scip-perl cpan Test-CheckManifest 1.43 main/`->()`().; |
| 105 | |
| 106 | isscip-perl cpan Test-CheckManifest 1.43 main/is(). $result, $expected; |
| 107 | |
| 108 | $cnt++; |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | { |
| 113 | local $Test::CheckManifest::VERBOSEscip-perl cpan Test-CheckManifest 1.43 Test/CheckManifest/$VERBOSE. = 0; |
| 114 | my @tests = ( |
| 115 | [ undef, undef, undef, 'test', 1 ], |
| 116 | [ ['/t/test'], undef, undef, 'test', '' ], |
| 117 | [ ['/t/test'], ['/t/test'], undef, 'test', 1 ], |
| 118 | [ ['/t/test'], undef, {'/t/test' => 1}, 'test', 1 ], |
| 119 | [ ['/t/test'], ['/test'], {'/t/test' => 1}, 'test', '' ], |
| 120 | [ ['/t/test'], ['/t/test', '/t/test'], undef, 'test', '' ], |
| 121 | [ ['/t/test','/t/test2'], ['/t/test'], undef, 'test', '' ], |
| 122 | ); |
| 123 | |
| 124 | for my $test ( @tests ) { |
| 125 | $diag = ''; |
| 126 | |
| 127 | my @params = @{$test}; |
| 128 | my $expected = popscip-perl cpan Test-CheckManifest 1.43 main/pop(). @params; |
| 129 | |
| 130 | my $result = $sub->( scip-perl cpan Test-CheckManifest 1.43 main/`->()`().@params, 'No Manifest' )scip-perl cpan Test-CheckManifest 1.43 main/`->()`().; |
| 131 | |
| 132 | isscip-perl cpan Test-CheckManifest 1.43 main/is(). $result, $expected; |
| 133 | |
| 134 | $cnt++; |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | done_testingscip-perl cpan Test-CheckManifest 1.43 main/done_testing().(); |