これは、ミンター用の非常に基本的なテスト ファイルです。
#!/usr/bin/perl
use strict;
use warnings;
use Dist::Zilla::Tester;
use Test::More;
use Path::Class;
my $tzil = Minter->_new_from_profile(
# which profile to run e.g. dzil new -p
[ Default => 'default' ],
# app name
{ name => 'CatApp', },
# location of whats esessntially your tests ~/.dzil
{ global_config_root => dir('corpus/mint')->absolute },
);
# same as running dzil new
$tzil->mint_dist;
# mint root, obviously getting the location of the temporary repo creation
my $mr = dir( $tzil->tempdir )->subdir('mint');
# test to see if CatApp.pm exists
ok( -e $mr->subdir('lib')->file('CatApp.pm'), 'CatApp.pm exists');
done_testing
もちろん、多くの実際のテストでは、作成されたファイルも読みたいと思うでしょう。これは で行うことができます$tzil->slurp_file('file');
。
通常のDist::Zilla::Testerテストとミントされた dist をテストすることはあまり変わらないので、簡単な Dist::Zilla::Tester テストの作成について私が書いたブログを読みたいと思うかもしれません。