File: empty-abstract.t

package info (click to toggle)
libdist-zilla-perl 6.032-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,928 kB
  • sloc: perl: 7,275; makefile: 4; sh: 1
file content (53 lines) | stat: -rw-r--r-- 1,070 bytes parent folder | download | duplicates (5)
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
50
51
52
53
use strict;
use warnings;

use Test::More;
use Test::DZil;
use Test::Fatal;
use Path::Tiny;
use List::Util 'first';

my $tzil = Builder->from_config(
    { dist_root => 't/does_not_exist' },
    {
        add_files => {
            path(qw(source dist.ini)) => simple_ini(
                'GatherDir',
            ),
            path(qw(source lib DZT Sample.pm)) => <<MODULE,
package DZT::Sample;

# ABSTRACT:

return 1;
__END__

=head1 NAME

DZT::Sample - a sample module for testing handling of empty ABSTRACT comment

=head1 HEY, MAINTAINER

Note that we have C<< =head1 NAME >> here, and an empty ABSTRACT comment.

The empty ABSTRACT comment should be skipped, and the NAME one used.

=cut
MODULE
        },
    },
);

is(
    exception { $tzil->build },
    undef,
    'build proceeds normally',
);

is(
    Dist::Zilla::Util->abstract_from_file(first { $_->name eq 'lib/DZT/Sample.pm' } @{$tzil->files}),
    'a sample module for testing handling of empty ABSTRACT comment',
    'We should see the abstract from the =head NAME section in pod',
);

done_testing;