NAME
Test::Dist::Zilla::BuiltFiles - TODO: Test your Dist::Zilla plugin in build action
VERSION
Version v0.3.0, released on 2015-09-19 23:00 UTC.
SYNOPSIS
package ManifestTester;
use Moose;
with 'Test::Dist::Zilla::Build';
with 'Test::Dist::Zilla::BuiltFiles';
use Test::Deep qw{ cmp_deeply re };
use Test::More;
run_me 'A test' => {
plugins => [
'GatherDir',
'Manifest',
'MetaJSON',
],
files => {
'lib/Dummy.pm' => 'package Dummy; 1;',
},
expected => {
files => {
'MANIFEST' => [
'lib/Dunny.pm',
'MANIFEST',
'META.json',
],
},
};
};
exit( 0 );
DESCRIPTION
This is a Test::Routine
-based role for testing Dist::Zilla
and its plugins. It is intended to be used in cooperation with Test::Dist::Zilla::Build
role. Test::Dist::Zilla::Build
builds the distribution and checks exception and build messages, while Test::Dist::Zilla::BuiltFiles
checks built files.
OBJECT METHODS
BuiltFiles
It is a test routine. It checks built files. Names of files to check should be be enlisted in files
key of expected
hash. Value should be HashRef
, keys are filenames, values are file content. File content may be specified as Str
or ArrayRef[Str]
:
run_me {
…
expected => {
files => {
'filename1' => "line1\nline2\n",
'filename2' => [
'line1', # Should not include newline character.
'line2'
],
'filename3' => undef, # This file should not exist.
},
},
};
For every file the test routine checks the file exists and its actual content matches the expected content. If expected content is undef
, the file should not exists.
Note: BuiltFiles
assumes successful build. If an exception occurred, BuiltFiles
skips all the checks.
SEE ALSO
- Test::Dist::Zilla
- Test::Dist::Zilla::Build
- "$ok = cmp_deeply($got, $expected, $name)" in Test::Deep
- Test::Routine
AUTHOR
Van de Bugger <van.de.bugger@gmail.com>
COPYRIGHT AND LICENSE
Copyright © 2015 Van de Bugger
This file is part of perl-Test-Dist-Zilla.
perl-Test-Dist-Zilla is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
perl-Test-Dist-Zilla is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with perl-Test-Dist-Zilla. If not, see <http://www.gnu.org/licenses/>.