Update Module::Load::Conditional to CPAN version 0.38
[p5sagit/p5-mst-13.2.git] / cpan / Module-Build / t / compat / exit.t
1 #!/usr/bin/perl -w
2
3 use strict;
4
5 use lib 't/lib';
6 use MBTest tests => 3;
7
8 blib_load('Module::Build');
9
10 #########################
11
12 my $tmp = MBTest->tmpdir;
13
14 # Create test distribution; set requires and build_requires
15 use DistGen;
16 my $dist = DistGen->new( dir => $tmp );
17
18 $dist->regen;
19
20 $dist->chdir_in;
21
22 #########################
23
24 my $mb; stdout_of(sub{ $mb = Module::Build->new_from_context});
25
26 blib_load('Module::Build::Compat');
27
28 $dist->regen;
29
30 stdout_stderr_of(
31   sub{ Module::Build::Compat->create_makefile_pl('passthrough', $mb); }
32 );
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
42 stdout_of(sub{ $mb->ACTION_realclean });
43
44 my $result;
45 my ($stdout, $stderr ) = stdout_stderr_of (sub {
46   $result = $mb->run_perl_script('Makefile.PL');
47 });
48 ok $result, "Makefile.PL exit";
49 like $stdout, qr/running Build\.PL/;
50 like $stderr, qr/you have no libthbbt$/;
51 #warn "out: $stdout"; warn "err: $stderr";
52
53 # vim:ts=2:sw=2:et:sta