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