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