Upgrade to MakeMaker 6.53_02
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / t / pm_to_blib.t
1 #!/usr/bin/perl -w
2
3 # Ensure pm_to_blib runs at the right times.
4
5 use strict;
6 use lib 't/lib';
7
8 use Test::More 'no_plan';
9
10 use ExtUtils::MakeMaker;
11
12 use MakeMaker::Test::Utils;
13 use MakeMaker::Test::Setup::BFD;
14
15
16 my $perl     = which_perl();
17 my $makefile = makefile_name();
18 my $make     = make_run();
19
20
21 # Setup our test environment
22 {
23     chdir 't';
24
25     perl_lib;
26
27     ok( setup_recurs(), 'setup' );
28     END {
29         ok( chdir File::Spec->updir );
30         ok( teardown_recurs(), 'teardown' );
31     }
32
33     ok( chdir('Big-Dummy'), "chdir'd to Big-Dummy" ) ||
34       diag("chdir failed: $!");
35 }
36
37
38 # Run make once
39 {
40     run_ok(qq{$perl Makefile.PL});
41     run_ok($make);
42
43     ok( -e "blib/lib/Big/Dummy.pm", "blib copied pm file" );
44 }
45
46
47 # Change a pm file, it should be copied.
48 {
49     # Wait a couple seconds else our changed file will have the same timestamp
50     # as the blib file
51     sleep 2;
52
53     ok( open my $fh, ">>", "lib/Big/Dummy.pm" ) or die $!;
54     print $fh "Something else\n";
55     close $fh;
56
57     run_ok($make);
58     like slurp("blib/lib/Big/Dummy.pm"), qr/Something else\n$/;
59 }
60
61
62 # Rerun the Makefile.PL, pm_to_blib should rerun
63 {
64     run_ok(qq{$perl Makefile.PL});
65
66     # XXX This is a fragile way to check that it reran.
67     like run_ok($make), qr/^Skip /ms;
68
69     ok( -e "blib/lib/Big/Dummy.pm", "blib copied pm file" );
70 }