summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-07-27 18:37:45 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-07-27 18:37:45 +0000
commit84a725ce7fe8d91d8384edf0aeea552b4d19c40e (patch)
tree02119e59ddd6e40cf0f4eabe2cf452efdb89773d /lib
parentbd6c346e4e3690246a860f9d51da416c9ee28c92 (diff)
downloadperl-84a725ce7fe8d91d8384edf0aeea552b4d19c40e.tar.gz
Missing MakeMaker test.
p4raw-id: //depot/perl@20237
Diffstat (limited to 'lib')
-rw-r--r--lib/ExtUtils/t/postamble.t65
1 files changed, 65 insertions, 0 deletions
diff --git a/lib/ExtUtils/t/postamble.t b/lib/ExtUtils/t/postamble.t
new file mode 100644
index 0000000000..b8c049277f
--- /dev/null
+++ b/lib/ExtUtils/t/postamble.t
@@ -0,0 +1,65 @@
+#!/usr/bin/perl -w
+
+# Wherein we ensure that postamble works ok.
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't' if -d 't';
+ @INC = ('../lib', 'lib');
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+
+use strict;
+use Test::More tests => 5;
+use MakeMaker::Test::Utils;
+use ExtUtils::MakeMaker;
+use TieOut;
+
+chdir 't';
+perl_lib;
+$| = 1;
+
+my $Makefile = makefile_name;
+
+ok( chdir 'Big-Dummy', q{chdir'd to Big-Dummy} ) ||
+ diag("chdir failed: $!");
+
+{
+ my $warnings = '';
+ local $SIG{__WARN__} = sub {
+ $warnings = join '', @_;
+ };
+
+ my $stdout = tie *STDOUT, 'TieOut' or die;
+ my $mm = WriteMakefile(
+ NAME => 'Big::Dummy',
+ VERSION_FROM => 'lib/Big/Dummy.pm',
+ postamble => {
+ FOO => 1,
+ BAR => "fugawazads"
+ }
+ );
+ is( $warnings, '', 'postamble argument not warned about' );
+}
+
+sub MY::postamble {
+ my($self, %extra) = @_;
+
+ is_deeply( \%extra, { FOO => 1, BAR => 'fugawazads' },
+ 'postamble args passed' );
+
+ return <<OUT;
+# This makes sure the postamble gets written
+OUT
+
+}
+
+
+ok( open(MAKEFILE, $Makefile) ) or diag "Can't open $Makefile: $!";
+{ local $/;
+ like( <MAKEFILE>, qr/^\# This makes sure the postamble gets written\n/m,
+ 'postamble added to the Makefile' );
+}