Update Module::Load::Conditional to CPAN version 0.38
[p5sagit/p5-mst-13.2.git] / cpan / Module-Build / t / files.t
CommitLineData
bb4e9162 1#!/usr/bin/perl -w
2
3use strict;
10b84a45 4use lib 't/lib';
613f422f 5use MBTest tests => 4;
bb4e9162 6
613f422f 7blib_load('Module::Build');
738349a8 8
9use IO::File;
7a827510 10my $tmp = MBTest->tmpdir;
bb4e9162 11
12use DistGen;
13my $dist = DistGen->new( dir => $tmp );
14$dist->regen;
15
738349a8 16$dist->chdir_in;
bb4e9162 17
bb4e9162 18my $mb = Module::Build->new_from_context;
bb4e9162 19
20{
21 # Make sure copy_if_modified() can handle spaces in filenames
7dc9e1b4 22
bb4e9162 23 my @tmp;
66e531b6 24 push @tmp, MBTest->tmpdir for (0 .. 1);
7dc9e1b4 25
bb4e9162 26 my $filename = 'file with spaces.txt';
7dc9e1b4 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;
7dc9e1b4 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');
7dc9e1b4 44
bb4e9162 45 ok( Module::Build->dir_contains($first, $second) );
46}
47