File: 05-no-collect_pod.t

package info (click to toggle)
libdist-zilla-role-modulemetadata-perl 0.006-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 324 kB
  • sloc: perl: 241; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 805 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
use strict;
use warnings;

use Test::More;

# this is just like t/04-collect_pod.t, except we request collect_pod => 0
# first and *then* collect_pod => 1, which means we need to load the file
# twice as the cached MMD object did not collect pod.

use Path::Tiny;
my $code = path('t', '04-collect_pod.t')->slurp_utf8;

my $tests = <<'TESTS';
{
    my $mmd = $plugin->module_metadata_for_file($tzil->main_module);    # collect_pod left to default to 0
    is($mmd->pod('HELLO'), undef, 'MMD object did not save pod content');
}

{
    my $mmd = $plugin->module_metadata_for_file($tzil->main_module, collect_pod => 1);
    is($mmd->pod('HELLO'), $pod_content, 'new MMD object created, which saved pod content');
}
TESTS
$code =~ s/^# BEGIN TESTS\n\K.*(# END TESTS)/$tests\n$1/ms;

eval $code;
die $@ if $@;