File: 01-basic.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 (84 lines) | stat: -rw-r--r-- 2,167 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
use strict;
use warnings;

use Test::More 0.88;
use if $ENV{AUTHOR_TESTING}, 'Test::Warnings';
use Test::DZil;
use Test::Deep;
use Test::Fatal;
use Path::Tiny;

use lib 't/lib';

my $tzil = Builder->from_config(
    { dist_root => 'does-not-exist' },
    {
        add_files => {
            path(qw(source dist.ini)) => simple_ini(
                [ GatherDir => ],
                [ MetaConfig => ],
                '=SimpleProvides',
            ),
            path(qw(source lib Foo.pm)) => <<'FOO',
package Foo;
our $VERSION = '0.001';
FOO
            path(qw(source lib Bar.pm)) => <<'BAR',
package Bar;
our $VERSION = '0.002';

package Bar::Baz;
our $VERSION = '0.003';
BAR
        },
    },
);

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

cmp_deeply(
    $tzil->distmeta,
    superhashof({
        provides => {
            'Foo' => {
                file => 'lib/Foo.pm',
                version => '0.001',
            },
            'Bar' => {
                file => 'lib/Bar.pm',
                version => '0.002',
            },
            'Bar::Baz' => {
                file => 'lib/Bar.pm',
                version => '0.003',
            },
        },
        x_Dist_Zilla => superhashof({
            plugins => supersetof(
                {
                    class => 'SimpleProvides',
                    config => {
                        # 'SimpleProvides' => { }, # if it implemented dump_config
                        'Dist::Zilla::Role::ModuleMetadata' => {
                            'Module::Metadata' => Module::Metadata->VERSION,
                            version => Dist::Zilla::Role::ModuleMetadata->VERSION,
                        },
                    },
                    name => '=SimpleProvides',
                    version => undef,
                },
            ),
        }),
    }),
    'plugin metadata contains data from Module::Metadata object, and dumped configs',
) or diag 'got distmeta: ', explain $tzil->distmeta;

diag 'got log messages: ', explain $tzil->log_messages
    if not Test::Builder->new->is_passing;

done_testing;