1Alien::Build::Plugin::TUessetr::CMoonctkr(i3b)uted PerlADloiceunm:e:nBtuaitlido:n:Plugin::Test::Mock(3)
2
3
4
6 Alien::Build::Plugin::Test::Mock - Mock plugin for testing
7
9 version 2.47
10
12 use alienfile;
13 plugin 'Test::Mock' => (
14 probe => 'share',
15 download => 1,
16 extract => 1,
17 build => 1,
18 gather => 1,
19 );
20
22 This plugin is used for testing Alien::Build plugins. Usually you only
23 want to test one or two phases in an alienfile for your plugin, but you
24 still have to have a fully formed alienfile that contains all required
25 phases. This plugin lets you fill in the other phases with the
26 appropriate hooks. This is usually better than using real plugins
27 which may pull in additional dynamic requirements that you do not want
28 to rely on at test time.
29
31 probe
32 plugin 'Test::Mock' => (
33 probe => $probe,
34 );
35
36 Override the probe behavior by one of the following:
37
38 share
39 For a "share" build.
40
41 system
42 For a "system" build.
43
44 die To throw an exception in the probe hook. This will usually cause
45 Alien::Build to try the next probe hook, if available, or to assume
46 a "share" install.
47
48 download
49 plugin 'Test::Mock' => (
50 download => \%fs_spec,
51 );
52
53 plugin 'Test::Mock' => (
54 download => 1,
55 );
56
57 Mock out a download. The %fs_spec is a hash where the hash values are
58 directories and the string values are files. This a spec like this:
59
60 plugin 'Test::Mock' => (
61 download => {
62 'foo-1.00' => {
63 'README.txt' => "something to read",
64 'foo.c' => "#include <stdio.h>\n",
65 "int main() {\n",
66 " printf(\"hello world\\n\");\n",
67 "}\n",
68 }
69 },
70 );
71
72 Would generate two files in the directory 'foo-1.00', a "README.txt"
73 and a C file named "foo.c". The default, if you provide a true non-
74 hash value is to generate a single tarball with the name
75 "foo-1.00.tar.gz".
76
77 extract
78 plugin 'Test::Mock' => (
79 extract => \%fs_spec,
80 );
81
82 plugin 'Test::Mock' => (
83 extract => 1,
84 );
85
86 Similar to "download" above, but for the "extract" phase.
87
88 build
89 plugin 'Test::Mock' => (
90 build => [ \%fs_spec_build, \%fs_spec_install ],
91 );
92
93 plugin 'Test::Mock' => (
94 build => 1,
95 );
96
97 gather
98 plugin 'Test::Mock' => (
99 gather => \%runtime_prop,
100 );
101
102 plugin 'Test::Mock' => (
103 gather => 1,
104 );
105
106 This adds a gather hook (for both "share" and "system") that adds the
107 given runtime properties, or if a true non-hash value is provided, some
108 reasonable runtime properties for testing.
109
111 Author: Graham Ollis <plicease@cpan.org>
112
113 Contributors:
114
115 Diab Jerius (DJERIUS)
116
117 Roy Storey (KIWIROY)
118
119 Ilya Pavlov
120
121 David Mertens (run4flat)
122
123 Mark Nunberg (mordy, mnunberg)
124
125 Christian Walde (Mithaldu)
126
127 Brian Wightman (MidLifeXis)
128
129 Zaki Mughal (zmughal)
130
131 mohawk (mohawk2, ETJ)
132
133 Vikas N Kumar (vikasnkumar)
134
135 Flavio Poletti (polettix)
136
137 Salvador Fandiño (salva)
138
139 Gianni Ceccarelli (dakkar)
140
141 Pavel Shaydo (zwon, trinitum)
142
143 Kang-min Liu (劉康民, gugod)
144
145 Nicholas Shipp (nshp)
146
147 Juan Julián Merelo Guervós (JJ)
148
149 Joel Berger (JBERGER)
150
151 Petr Písař (ppisar)
152
153 Lance Wicks (LANCEW)
154
155 Ahmad Fatoum (a3f, ATHREEF)
156
157 José Joaquín Atria (JJATRIA)
158
159 Duke Leto (LETO)
160
161 Shoichi Kaji (SKAJI)
162
163 Shawn Laffan (SLAFFAN)
164
165 Paul Evans (leonerd, PEVANS)
166
167 Håkon Hægland (hakonhagland, HAKONH)
168
169 nick nauwelaerts (INPHOBIA)
170
172 This software is copyright (c) 2011-2020 by Graham Ollis.
173
174 This is free software; you can redistribute it and/or modify it under
175 the same terms as the Perl 5 programming language system itself.
176
177
178
179perl v5.34.0 2022-03-07Alien::Build::Plugin::Test::Mock(3)