Remove unused Module::Build tests
[p5sagit/p5-mst-13.2.git] / lib / Module / Build / t / files.t
CommitLineData
bb4e9162 1#!/usr/bin/perl -w
2
3use strict;
4use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
5use MBTest tests => 6;
6
7use Cwd ();
8my $cwd = Cwd::cwd;
9my $tmp = File::Spec->catdir( $cwd, 't', '_tmp' );
10
11use DistGen;
12my $dist = DistGen->new( dir => $tmp );
13$dist->regen;
14
15chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
16
17
18use IO::File;
19
20
21use Module::Build;
22my $mb = Module::Build->new_from_context;
23my @files;
24
25{
26 # Make sure copy_if_modified() can handle spaces in filenames
27
28 my @tmp;
29 foreach (1..2) {
30 my $tmp = File::Spec->catdir('t', "tmp$_");
31 $mb->add_to_cleanup($tmp);
32 push @files, $tmp;
33 unless (-d $tmp) {
34 mkdir($tmp, 0777) or die "Can't create $tmp: $!";
35 }
36 ok -d $tmp;
37 $tmp[$_] = $tmp;
38 }
39
40 my $filename = 'file with spaces.txt';
41
42 my $file = File::Spec->catfile($tmp[1], $filename);
43 my $fh = IO::File->new($file, '>') or die "Can't create $file: $!";
44 print $fh "Foo\n";
45 $fh->close;
46 ok -e $file;
47
48
49 my $file2 = $mb->copy_if_modified(from => $file, to_dir => $tmp[2]);
50 ok $file2;
51 ok -e $file2;
52}
53
54{
55 # Try some dir_contains() combinations
56 my $first = File::Spec->catdir('', 'one', 'two');
57 my $second = File::Spec->catdir('', 'one', 'two', 'three');
58
59 ok( Module::Build->dir_contains($first, $second) );
60}
61
62# cleanup
63chdir( $cwd ) or die "Can''t chdir to '$cwd': $!";
64$dist->remove;
65
66use File::Path;
67rmtree( $tmp );