Updated Module::Build to 0.36
[p5sagit/p5-mst-13.2.git] / cpan / ExtUtils-MakeMaker / t / postamble.t
CommitLineData
84a725ce 1#!/usr/bin/perl -w
2
3# Wherein we ensure that postamble works ok.
4
5BEGIN {
b78fd716 6 unshift @INC, 't/lib';
84a725ce 7}
8
9use strict;
a7d1454b 10use Test::More tests => 8;
84a725ce 11use MakeMaker::Test::Utils;
a7d1454b 12use MakeMaker::Test::Setup::BFD;
84a725ce 13use ExtUtils::MakeMaker;
14use TieOut;
15
16chdir 't';
17perl_lib;
18$| = 1;
19
20my $Makefile = makefile_name;
21
a7d1454b 22ok( setup_recurs(), 'setup' );
23END {
24 ok( chdir File::Spec->updir );
25 ok( teardown_recurs(), 'teardown' );
26}
27
84a725ce 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}
dd0810f9 67close MAKEFILE;