Skip to content

Commit 358c997

Browse files
committed
Add isolated tests for Mohawks include-default patch
1 parent 055ddfd commit 358c997

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

t/maniskip-include-default.t

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
use strict;
2+
use warnings;
3+
4+
use Test::More tests => 3;
5+
use ExtUtils::Manifest qw( maniskip );
6+
use File::Temp qw( tempdir );
7+
use Cwd qw( abs_path );
8+
use Carp qw( croak );
9+
10+
# ABSTRACT: Ensure include-default is memory only
11+
my $cwd = abs_path('.');
12+
{
13+
my $tempdir = tempdir(
14+
TEMPLATE => "EUM-include-default-XXXXXX",
15+
TMPDIR => 1,
16+
CLEANUP => !$ENV{PRESERVE_TEMPDIR},
17+
);
18+
note("Working in $tempdir");
19+
chdir $tempdir or croak "Can't chdir to '$tempdir'";
20+
21+
{
22+
open my $fh, ">:unix", "MANIFEST.SKIP" or croak "Couldn't open MANIFEST.SKIP: $!";
23+
print $fh qq[#!include_default] or croak "Couldn't write to MANIFEST.SKIP: $!";
24+
close $fh or croak "Couldn't write to MANIFEST.SKIP: $!";
25+
}
26+
27+
my $skipchk = maniskip();
28+
29+
my $skipcontents = do {
30+
open my $fh, "<:unix", "MANIFEST.SKIP" or croak "Couldn't open MANIFEST.SKIP: $!";
31+
local $/;
32+
<$fh>;
33+
};
34+
35+
unlike( $skipcontents, qr/#!start\s*included/, 'include_default not expanded on disk' );
36+
37+
ok( $skipchk->('Makefile'), 'Makefile still skipped by default' );
38+
ok( !$skipchk->('Makefile.PL'), 'Makefile.PL still not skipped by default' );
39+
40+
chdir $cwd or croak "Couldn't return to $cwd: $!";
41+
}
42+
done_testing;

0 commit comments

Comments
 (0)