File: 50_mint.t

package info (click to toggle)
libdist-zilla-plugin-run-perl 0.050-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 444 kB
  • sloc: perl: 580; makefile: 2
file content (46 lines) | stat: -rw-r--r-- 1,349 bytes parent folder | download | duplicates (3)
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
use strict;
use warnings;
use Test::More 0.88;
use Test::DZil;
use Path::Tiny;

use Test::File::ShareDir -share => {
  -module => { 'Dist::Zilla::MintingProfile::Default' => 'test_data/profiles' },
};

{
  my $tzil = Minter->_new_from_profile(
    [ Default => 'default' ],
    { name    => 'DZT-Minty' ,},
    { global_config_root =>
        eval 'require Dist::Zilla::Dist::Minter; Dist::Zilla::Dist::Minter->VERSION("5.038"); 1'
            ? 'test_data/global'
            # older DZ requires this to quack like a Path::Class
            : do { require Path::Class; Path::Class::dir('test_data/global')->absolute },
    },
  );

  $tzil->chrome->logger->set_debug(1);
  $tzil->mint_dist();

  my $dir = path($tzil->tempdir)->child(qw(mint empty_dir));

  ok -d $dir, 'created directory in mint dir';

  # extra protection for spaces - see perldoc -f glob
  my $children = $dir->child('*');
  is_deeply [glob(qq{"$children"})], [], 'dir is empty but exists';

  like path($tzil->tempdir)->child(qw(mint lib DZT Minty.pm))->slurp_utf8,
    qr/package DZT::Minty;/,
    'minted regular file';

  like path($tzil->tempdir)->child('mint/minted_at.txt')->slurp_utf8,
    qr/DZT-Minty minted at \d+/,
    'created file the hard way';

  diag 'got log messages: ', explain $tzil->log_messages
    if not Test::Builder->new->is_passing;
}

done_testing;