3 # This is a test of the verification of the arguments to
7 if( $ENV{PERL_CORE} ) {
9 @INC = ('../lib', 'lib');
12 unshift @INC, 't/lib';
17 use Test::More tests => 16;
20 use MakeMaker::Test::Utils;
22 use ExtUtils::MakeMaker;
28 ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) ||
29 diag("chdir failed: $!");
32 ok( my $stdout = tie *STDOUT, 'TieOut' );
34 local $SIG{__WARN__} = sub {
35 $warnings .= join '', @_;
38 my $mm = WriteMakefile(
40 VERSION_FROM => 'lib/Big/Dummy.pm',
41 MAN3PODS => ' ', # common mistake
44 is( $warnings, <<VERIFY );
45 WARNING: MAN3PODS takes a hash reference not a string/number.
46 Please inform the author.
48 is_deeply( $mm->{MAN3PODS}, {}, 'Wrong argument type corrected' );
53 VERSION_FROM => 'lib/Big/Dummy.pm',
57 is( $warnings, <<VERIFY );
58 WARNING: AUTHOR takes a string/number not a code reference.
59 Please inform the author.
62 is_deeply( $mm->{AUTHOR}, '' );
65 # LIBS accepts *both* a string or an array ref. The first cut of
66 # our verification did not take this into account.
70 VERSION_FROM => 'lib/Big/Dummy.pm',
71 LIBS => '-lwibble -lwobble',
74 # We'll get warnings about the bogus libs, that's ok.
75 unlike( $warnings, qr/WARNING: .* takes/ );
76 is_deeply( $mm->{LIBS}, ['-lwibble -lwobble'] );
81 VERSION_FROM => 'lib/Big/Dummy.pm',
82 LIBS => ['-lwibble', '-lwobble'],
85 # We'll get warnings about the bogus libs, that's ok.
86 unlike( $warnings, qr/WARNING: .* takes/ );
87 is_deeply( $mm->{LIBS}, ['-lwibble', '-lwobble'] );
92 VERSION_FROM => 'lib/Big/Dummy.pm',
93 LIBS => { wibble => "wobble" },
96 # We'll get warnings about the bogus libs, that's ok.
97 like( $warnings, qr{^WARNING: LIBS takes a array reference or string/number not a hash reference}m );
98 is_deeply( $mm->{LIBS}, [] );
103 NAME => 'Big::Dummy',
104 WIBBLE => 'something',
105 wump => { foo => 42 },
108 like( $warnings, qr{^WARNING: WIBBLE is not a known parameter.\n}m );
109 like( $warnings, qr{^WARNING: wump is not a known parameter.\n}m );
111 is( $mm->{WIBBLE}, 'something' );
112 is_deeply( $mm->{wump}, { foo => 42 } );