File: test.t

package info (click to toggle)
libdist-zilla-plugin-requiresexternal-perl 1.009-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 252 kB
  • sloc: perl: 622; makefile: 4
file content (38 lines) | stat: -rwxr-xr-x 1,101 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
#!/usr/bin/env perl

use Modern::Perl '2010';    ## no critic (Modules::ProhibitUseQuotedVersion)
use Config;
use English '-no_match_vars';
use Test::Most tests => 3;
use Test::DZil;
use Env::Path 'PATH';
use Path::Class;

my $perl = file($EXECUTABLE_NAME);
if ( $OSNAME ne 'VMS' ) {
    $perl = file("$perl$Config{_exe}") unless $perl =~ m/$Config{_exe}$/i;
}
PATH->Prepend( $perl->dir->stringify() );

my $tzil = Builder->from_config(
    { dist_root => 1 },
    {   add_files => {
            'source/dist.ini' => simple_ini(
                ['@Basic'],
                [   RequiresExternal =>
                        { requires => [ "$perl", $perl->basename ] },
                ],
            ),
            'source/lib/DZT/Sample.pm' => <<'END_SAMPLE_PM' } } );
package DZT::Sample;
# ABSTRACT: Sample package
1;
END_SAMPLE_PM

lives_ok( sub { $tzil->build() }, 'build' );
ok( ( grep { $ARG->name eq 't/requires_external.t' } @{ $tzil->files } ),
    'test script added' );
lives_ok(
    sub { $tzil->run_tests_in( $tzil->built_in ) },
    "run DZ tests: $perl executable and added to PATH",
);