Skip to content

Commit 0312722

Browse files
committed
t/maniadd.t: auto_add_newlines test from Manifest.t
1 parent 939bb6b commit 0312722

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

t/Manifest.t

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ chdir 't';
1414

1515
use strict;
1616

17-
use Test::More tests => 64;
17+
use Test::More tests => 63;
1818
use Cwd;
1919

2020
use File::Spec;
@@ -300,19 +300,6 @@ my @funky_keys = qw(space space_quote space_backslash space_quote_backslash);
300300
$Files{"$_.bak"}++ for ('MANIFEST', "MANIFEST${extsep}SKIP");
301301
}
302302

303-
add_file('MANIFEST' => 'Makefile.PL');
304-
maniadd({ foo => 'bar' });
305-
$files = maniread;
306-
# VMS downcases the MANIFEST. We normalize it here to match.
307-
%$files = map { (lc $_ => $files->{$_}) } keys %$files;
308-
my %expect = ( 'makefile.pl' => '',
309-
'foo' => 'bar'
310-
);
311-
is_deeply( $files, \%expect, 'maniadd() vs MANIFEST without trailing newline');
312-
313-
#add_file('MANIFEST' => 'Makefile.PL');
314-
#maniadd({ foo => 'bar' });
315-
316303
END {
317304
note "remove all files";
318305
for my $file ( sort keys %Files ) {

t/maniadd.t

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ use warnings;
33

44
use lib 't/lib';
55
use ManifestTest qw( catch_warning canon_warning spew runtemp );
6-
use ExtUtils::Manifest qw( maniadd );
6+
use ExtUtils::Manifest qw( maniadd maniread );
77
use Config;
8-
use Test::More tests => 7;
8+
use Test::More tests => 8;
99

1010
my $LAST_ERROR;
1111

@@ -73,3 +73,18 @@ SKIP: {
7373

7474
};
7575

76+
runtemp "maniadd.auto_add_newlines" => sub {
77+
note "Ensuring lack of a trailing source newline does not break maniadd";
78+
spew( "MANIFEST", "initial_content" );
79+
maniadd( { "newfile", "newcomment" } );
80+
81+
my $read = maniread;
82+
83+
# VMS downcases the MANIFEST. We normalize it here to match.
84+
my (%got) = map { lc $_ => $read->{$_} } keys %{$read};
85+
my (%expected) = (
86+
"initial_content" => "",
87+
"newfile" => "newcomment"
88+
);
89+
is_deeply( \%got, \%expected, "maniadd added new entries to MANIFEST with newline included" );
90+
};

0 commit comments

Comments
 (0)