File: load_config.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 (71 lines) | stat: -rw-r--r-- 1,847 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
use strict;
use warnings;

use Test::More;
use Test::DZil;
use Test::Fatal;

{
    package Dist::Zilla::PluginBundle::Bunk;
    use Moose;
    with 'Dist::Zilla::Role::PluginBundle::Easy';
    sub configure {
        my $self = shift;
        $self->add_plugins('DoesNotExist');
    }
}

like(
    exception {
        Builder->from_config(
            { dist_root => 't/does-not-exist' },
            {
                add_files => {
                    'source/dist.ini' => simple_ini(
                        'DoesNotExist',
                    ),
                },
            },
        );
    },
    qr/Required plugin Dist::Zilla::Plugin::DoesNotExist isn't installed\.\n\n/,
    'missing plugin is detected properly',
);

like(
    exception {
        Builder->from_config(
            { dist_root => 't/does-not-exist' },
            {
                add_files => {
                    'source/dist.ini' => simple_ini(
                        '@DoesNotExist',
                    ),
                },
            },
        );
    },
    qr/Required plugin bundle Dist::Zilla::PluginBundle::DoesNotExist isn't installed\.\n\n/,
    'missing plugin bundle is detected properly',
);

like(
    exception {
        Builder->from_config(
            { dist_root => 't/does-not-exist' },
            {
                add_files => {
                    'source/dist.ini' => simple_ini(
                        '@Bunk',
                    ),
                },
            },
        );
    },
    # with Config::MVP 2.200009, we get:
    # 'Can't locate object method "section_name" via package "Moose::Meta::Class::__ANON__::SERIAL::17" at lib/Dist/Zilla/Dist/Builder.pm line 269.
    qr/Required plugin Dist::Zilla::Plugin::DoesNotExist isn't installed\.\n\n/,
    'missing plugin within a bundle is detected properly',
);

done_testing;