Commit | Line | Data |
bb4e9162 |
1 | #!/usr/bin/perl -w |
2 | |
3 | use strict; |
10b84a45 |
4 | use lib 't/lib'; |
613f422f |
5 | use MBTest tests => 4; |
bb4e9162 |
6 | |
613f422f |
7 | blib_load('Module::Build'); |
738349a8 |
8 | |
9 | use IO::File; |
7a827510 |
10 | my $tmp = MBTest->tmpdir; |
bb4e9162 |
11 | |
12 | use DistGen; |
13 | my $dist = DistGen->new( dir => $tmp ); |
14 | $dist->regen; |
15 | |
738349a8 |
16 | $dist->chdir_in; |
bb4e9162 |
17 | |
bb4e9162 |
18 | my $mb = Module::Build->new_from_context; |
bb4e9162 |
19 | |
20 | { |
21 | # Make sure copy_if_modified() can handle spaces in filenames |
22 | |
23 | my @tmp; |
66e531b6 |
24 | push @tmp, MBTest->tmpdir for (0 .. 1); |
bb4e9162 |
25 | |
26 | my $filename = 'file with spaces.txt'; |
27 | |
66e531b6 |
28 | my $file = File::Spec->catfile($tmp[0], $filename); |
bb4e9162 |
29 | my $fh = IO::File->new($file, '>') or die "Can't create $file: $!"; |
30 | print $fh "Foo\n"; |
31 | $fh->close; |
32 | ok -e $file; |
33 | |
34 | |
66e531b6 |
35 | my $file2 = $mb->copy_if_modified(from => $file, to_dir => $tmp[1]); |
bb4e9162 |
36 | ok $file2; |
37 | ok -e $file2; |
38 | } |
39 | |
40 | { |
41 | # Try some dir_contains() combinations |
42 | my $first = File::Spec->catdir('', 'one', 'two'); |
43 | my $second = File::Spec->catdir('', 'one', 'two', 'three'); |
44 | |
45 | ok( Module::Build->dir_contains($first, $second) ); |
46 | } |
47 | |