Update Module::Load::Conditional to CPAN version 0.38
[p5sagit/p5-mst-13.2.git] / cpan / Module-Build / t / compat / exit.t
CommitLineData
66e531b6 1#!/usr/bin/perl -w
2
3use strict;
4
10b84a45 5use lib 't/lib';
613f422f 6use MBTest tests => 3;
66e531b6 7
613f422f 8blib_load('Module::Build');
66e531b6 9
10#########################
11
12my $tmp = MBTest->tmpdir;
13
14# Create test distribution; set requires and build_requires
15use DistGen;
16my $dist = DistGen->new( dir => $tmp );
17
18$dist->regen;
19
20$dist->chdir_in;
21
22#########################
23
24my $mb; stdout_of(sub{ $mb = Module::Build->new_from_context});
25
613f422f 26blib_load('Module::Build::Compat');
66e531b6 27
28$dist->regen;
29
613f422f 30stdout_stderr_of(
31 sub{ Module::Build::Compat->create_makefile_pl('passthrough', $mb); }
32);
66e531b6 33
34# as silly as all of this exit(0) business is, that is what the cpan
35# testers have instructed everybody to do so...
36$dist->change_file('Build.PL' =>
37 "warn qq(you have no libthbbt\n); exit;\n" . $dist->get_file('Build.PL')
38);
39
40$dist->regen;
41
42stdout_of(sub{ $mb->ACTION_realclean });
43
44my $result;
45my ($stdout, $stderr ) = stdout_stderr_of (sub {
46 $result = $mb->run_perl_script('Makefile.PL');
47});
48ok $result, "Makefile.PL exit";
49like $stdout, qr/running Build\.PL/;
50like $stderr, qr/you have no libthbbt$/;
51#warn "out: $stdout"; warn "err: $stderr";
52
53# vim:ts=2:sw=2:et:sta