File: 05-failure.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 (49 lines) | stat: -rw-r--r-- 1,192 bytes parent folder | download | duplicates (3)
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
47
48
49
use strict;
use warnings;

use Test::Tester 0.108;
use Test::More 0.88;
use Test::Deep;
use if $ENV{AUTHOR_TESTING}, 'Test::Warnings';

require Test::Kwalitee;
my ($premature, @results) = run_tests(
    sub {
        # prevent Test::Kwalitee from making a plan
        no warnings 'redefine';
        local *Test::Builder::plan = sub { };
        local *Test::Builder::done_testing = sub { };

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

        chdir 't/corpus';

        Test::Kwalitee->import( tests => [ qw(has_changelog no_symlinks) ] );
    },
);

cmp_deeply(
    \@results,
    [
        superhashof({
            name => 'has_changelog',
            depth => 1,
            ok => 0,
            actual_ok => 0,
            type => '',
            diag => re(qr/^Error: The distribution ...+\nRemedy: Add a/s),
        }),
        superhashof({
            name => 'no_symlinks',
            depth => 1,
            ok => 1,
            actual_ok => 1,
            type => '',
            diag => ignore,
        }),
    ],
    'test fails, with diagnosis',
) or diag 'got results: ', explain \@results;

done_testing;