Skip to content

Commit

Permalink
Add isolated tests for Mohawks include-default patch
Browse files Browse the repository at this point in the history
  • Loading branch information
kentfredric committed Jul 8, 2015
1 parent 86c466f commit 9831378
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions t/maniskip.include-default.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
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 qw( in_tempdir );

sub _spew {
my ( $filename, $content ) = @_;
open my $fh, '>', $filename or die "Can't open $filename for writing. $!";
print {$fh} $content or die "Error writing to $filename. $!";
close $fh or die "Error closing $filename. $!";
}

sub _slurp {
my ($filename) = @_;
my $content;
open my $fh, '<', $filename or die "Can't open $filename for reading. $!";
local $/ = undef;
$content = <$fh>;
close $fh or warn "Error closing $filename. $!";
return $content;
}

in_tempdir 'noexpansions' => sub {

_spew( 'MANIFEST.SKIP', qq[#!include_default] );

my $skipchk = maniskip();

my $skipcontents = _slurp('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;

0 comments on commit 9831378

Please sign in to comment.