diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2015-06-11 22:32:06 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2015-06-11 22:32:06 +0000 |
commit | 467298a34215401cdcbb1dded51bc2aba5f1f41c (patch) | |
tree | 1923f32fbc9cf8f0b4ab291d1eb9fad5ab872d68 /t/files.t | |
download | Module-Build-tarball-master.tar.gz |
Module-Build-0.4214HEADModule-Build-0.4214master
Diffstat (limited to 't/files.t')
-rw-r--r-- | t/files.t | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/t/files.t b/t/files.t new file mode 100644 index 0000000..e951b80 --- /dev/null +++ b/t/files.t @@ -0,0 +1,46 @@ +#!/usr/bin/perl -w + +use strict; +use lib 't/lib'; +use MBTest tests => 4; + +blib_load('Module::Build'); + +my $tmp = MBTest->tmpdir; + +use DistGen; +my $dist = DistGen->new( dir => $tmp ); +$dist->regen; + +$dist->chdir_in; + +my $mb = Module::Build->new_from_context; + +{ + # Make sure copy_if_modified() can handle spaces in filenames + + my @tmp; + push @tmp, MBTest->tmpdir for (0 .. 1); + + my $filename = 'file with spaces.txt'; + + my $file = File::Spec->catfile($tmp[0], $filename); + open(my $fh, '>', $file) or die "Can't create $file: $!"; + print $fh "Foo\n"; + close $fh; + ok -e $file; + + + my $file2 = $mb->copy_if_modified(from => $file, to_dir => $tmp[1]); + ok $file2; + ok -e $file2; +} + +{ + # Try some dir_contains() combinations + my $first = File::Spec->catdir('', 'one', 'two'); + my $second = File::Spec->catdir('', 'one', 'two', 'three'); + + ok( Module::Build->dir_contains($first, $second) ); +} + |