diff --git a/t/maniskip.include-default.t b/t/maniskip.include-default.t new file mode 100644 index 0000000..4763f0d --- /dev/null +++ b/t/maniskip.include-default.t @@ -0,0 +1,41 @@ +use strict; +use warnings; + +use Test::More tests => 3; +use ExtUtils::Manifest qw( maniskip ); + +# ABSTRACT: Ensure include-default is memory only + +use lib 't/tlib'; +use Test::TempDir::Tiny; +use Cwd qw( getcwd ); + +my $cwd = getcwd(); +END { chdir $cwd } + +my $tempdir = tempdir(); +chdir $tempdir; + +{ + open my $fh, '>', 'MANIFEST.SKIP' or die "Can't open MANIFEST.SKIP for writing. $!"; + print {$fh} qq[#!include_default] or die "Error writing to MANIFEST.SKIP. $!"; + close $fh or die "Error closing MANIFEST.SKIP. $!" +} + +my $skipchk = maniskip(); + +my $skipcontents; +{ + open my $fh, '<', 'MANIFEST.SKIP' or die "Can't open MANIFEST.SKIP for reading. $!"; + local $/ = undef; + $skipcontents = <$fh>; + close $fh or warn "Error closing MANIFEST.SKIP. $!"; +} + +unlike( $skipcontents, qr/#!start\s*included/, 'include_default not expanded on disk' ); + +ok( $skipchk->('Makefile'), 'Makefile still skipped by default' ); +ok( !$skipchk->('Makefile.PL'), 'Makefile.PL still not skipped by default' ); + +done_testing; +