1#!/usr/bin/perl -w 2 3# Wherein we ensure that postamble works ok. 4 5BEGIN { 6 if( $ENV{PERL_CORE} ) { 7 chdir 't' if -d 't'; 8 @INC = ('../lib', 'lib'); 9 } 10 else { 11 unshift @INC, 't/lib'; 12 } 13} 14 15use strict; 16use Test::More tests => 5; 17use MakeMaker::Test::Utils; 18use ExtUtils::MakeMaker; 19use TieOut; 20 21chdir 't'; 22perl_lib; 23$| = 1; 24 25my $Makefile = makefile_name; 26 27ok( chdir 'Big-Dummy', q{chdir'd to Big-Dummy} ) || 28 diag("chdir failed: $!"); 29 30{ 31 my $warnings = ''; 32 local $SIG{__WARN__} = sub { 33 $warnings = join '', @_; 34 }; 35 36 my $stdout = tie *STDOUT, 'TieOut' or die; 37 my $mm = WriteMakefile( 38 NAME => 'Big::Dummy', 39 VERSION_FROM => 'lib/Big/Dummy.pm', 40 postamble => { 41 FOO => 1, 42 BAR => "fugawazads" 43 } 44 ); 45 is( $warnings, '', 'postamble argument not warned about' ); 46} 47 48sub MY::postamble { 49 my($self, %extra) = @_; 50 51 is_deeply( \%extra, { FOO => 1, BAR => 'fugawazads' }, 52 'postamble args passed' ); 53 54 return <<OUT; 55# This makes sure the postamble gets written 56OUT 57 58} 59 60 61ok( open(MAKEFILE, $Makefile) ) or diag "Can't open $Makefile: $!"; 62{ local $/; 63 like( <MAKEFILE>, qr/^\# This makes sure the postamble gets written\n/m, 64 'postamble added to the Makefile' ); 65} 66