Update Module::Build to 0.3603
[p5sagit/p5-mst-13.2.git] / cpan / Module-Build / t / files.t
1 #!/usr/bin/perl -w
2
3 use strict;
4 use lib 't/lib';
5 use MBTest tests => 4;
6
7 blib_load('Module::Build');
8
9 use IO::File;
10 my $tmp = MBTest->tmpdir;
11
12 use DistGen;
13 my $dist = DistGen->new( dir => $tmp );
14 $dist->regen;
15
16 $dist->chdir_in;
17
18 my $mb = Module::Build->new_from_context;
19
20 {
21   # Make sure copy_if_modified() can handle spaces in filenames
22
23   my @tmp;
24   push @tmp, MBTest->tmpdir for (0 .. 1);
25
26   my $filename = 'file with spaces.txt';
27
28   my $file = File::Spec->catfile($tmp[0], $filename);
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
35   my $file2 = $mb->copy_if_modified(from => $file, to_dir => $tmp[1]);
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