1Test::DZil(3) User Contributed Perl Documentation Test::DZil(3)
2
3
4
6 Test::DZil - tools for testing Dist::Zilla plugins
7
9 version 6.024
10
12 Test::DZil provides routines for writing tests for Dist::Zilla plugins.
13
15 This module should work on any version of perl still receiving updates
16 from the Perl 5 Porters. This means it should work on any version of
17 perl released in the last two to three years. (That is, if the most
18 recently released version is v5.40, then this module should work on
19 both v5.40 and v5.38.)
20
21 Although it may work on older versions of perl, no guarantee is made
22 that the minimum required version will not be increased. The version
23 may be increased for any reason, and there is no promise that patches
24 will be accepted to lower the minimum required perl.
25
27 Builder
28 Minter
29 my $tzil = Builder->from_config(...);
30
31 These return class names that subclass Dist::Zilla::Dist::Builder or
32 Dist::Zilla::Dist::Minter, respectively, with the Dist::Zilla::Tester
33 behavior added.
34
35 is_filelist
36 is_filelist( \@files_we_have, \@files_we_want, $desc );
37
38 This test assertion compares two arrayrefs of filenames, taking care of
39 slash normalization and sorting. @files_we_have may also contain
40 objects that do Dist::Zilla::Role::File.
41
42 is_yaml
43 is_yaml( $yaml_string, $want_struct, $comment );
44
45 This test assertion deserializes the given YAML string and does a
46 "cmp_deeply".
47
48 is_json
49 is_json( $json_string, $want_struct, $comment );
50
51 This test assertion deserializes the given JSON string and does a
52 "cmp_deeply".
53
54 dist_ini
55 my $ini_text = dist_ini(\%root_config, @plugins);
56
57 This routine returns a string that could be used to populate a simple
58 dist.ini file. The %root_config gives data for the "root" section of
59 the configuration. To provide a line multiple times, provide an
60 arrayref. For example, the root section could read:
61
62 {
63 name => 'Dist-Sample',
64 author => [
65 'J. Smith <jsmith@example.com>',
66 'Q. Smith <qsmith@example.com>',
67 ],
68 }
69
70 The root section is optional.
71
72 Plugins can be given in a few ways:
73
74 "PluginMoniker"
75 "[ "PluginMoniker" ]"
76 These become "[PluginMoniker]"
77
78 "[ "PluginMoniker", "PluginName" ]"
79 This becomes "[PluginMoniker / PluginName]"
80
81 "[ "PluginMoniker", { ... } ]"
82 "[ "PluginMoniker", "PluginName", { ... } ]"
83 These use the given hashref as the parameters inside the section,
84 with the same semantics as the root section.
85
86 simple_ini
87 This behaves exactly like "dist_ini", but it merges any given root
88 config into a starter config, which means that you can often skip any
89 explicit root config. The starter config may change slightly over
90 time, but is something like this:
91
92 {
93 name => 'DZT-Sample',
94 abstract => 'Sample DZ Dist',
95 version => '0.001',
96 author => 'E. Xavier Ample <example@example.org>',
97 license => 'Perl_5',
98 copyright_holder => 'E. Xavier Ample',
99 }
100
102 Ricardo SIGNES 😏 <rjbs@semiotic.systems>
103
105 This software is copyright (c) 2021 by Ricardo SIGNES.
106
107 This is free software; you can redistribute it and/or modify it under
108 the same terms as the Perl 5 programming language system itself.
109
110
111
112perl v5.34.0 2022-01-21 Test::DZil(3)