File: 08-taint.t

package info (click to toggle)
libtest-kwalitee-perl 1.28-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 348 kB
  • sloc: perl: 321; makefile: 2
file content (46 lines) | stat: -rw-r--r-- 1,115 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/perl -T
use strict;
use warnings;

use Test::More 0.96;

# we are testing ourselves, so we don't want this warning
BEGIN { $ENV{_KWALITEE_NO_WARN} = 1; }

BEGIN {
    $TODO = 'local::lib is not compatible with taint mode'
        if $ENV{PERL_LOCAL_LIB_ROOT};

    $TODO ||= 'PERL5LIB overrides are not compatible with taint mode'
        if $ENV{PERL5LIB};

    $TODO ||= 'version.pm earlier than 0.9918 misbehaves under taint mode'
        if "$]" < '5.017002' && do { require version; version->VERSION } < '0.9918';
}

use if $ENV{AUTHOR_TESTING} && !$TODO, 'Test::Warnings';

# these tests all pass without building the dist
my @expected = qw(
    has_changelog
    has_readme
    has_tests
);

my $test_count;
subtest 'Test::Kwalitee import' => sub {
    # we use an eval because Module::CPANTS::Analyse is not yet taint-clean
    eval {
        require Test::Kwalitee;
        Test::Kwalitee->import(tests => \@expected);
    } or diag $@;
    $test_count = Test::Builder->new->current_test;
};

is(
    $test_count,
    scalar(@expected),
    'ran the expected number of tests',
);

done_testing;