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