3 # Things like the CPAN shell rely on the "MakeMaker Parameters" section of the
4 # Makefile to learn a module's dependencies so we'd damn well better test it.
13 use ExtUtils::MakeMaker;
16 my $mm = bless {}, "MM";
19 my $text = join "\n", @_;
21 $text =~ s{^\s* \# \s+ MakeMaker\ Parameters: \s*\n}{}x;
26 return { eval "$text" };
31 my $want = @_ ? shift : $args;
33 my $have = extract_params($mm->_MakeMaker_Parameters_section($args));
35 local $Test::Builder::Level = $Test::Builder::Level + 1;
36 is_deeply $have, $want or diag explain $have, "\n", $want;
39 is join("", $mm->_MakeMaker_Parameters_section()), <<'EXPECT', "nothing";
40 # MakeMaker Parameters:
43 test_round_trip({ NAME => "Foo" });
44 test_round_trip({ NAME => "Foo", PREREQ_PM => { "Foo::Bar" => 0 } });
45 test_round_trip({ NAME => "Foo", PREREQ_PM => { "Foo::Bar" => 1.23 } });
47 # Test the special case for BUILD_REQUIRES
51 PREREQ_PM => { "Foo::Bar" => 1.23 },
52 BUILD_REQUIRES => { "Baz" => 0.12 },
61 BUILD_REQUIRES => { "Baz" => 0.12 },
64 test_round_trip( $have, $want );