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