File: files.t

package info (click to toggle)
perl 5.10.1-17squeeze6
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 74,280 kB
  • ctags: 49,087
  • sloc: perl: 319,380; ansic: 193,238; sh: 37,981; pascal: 8,830; lisp: 7,515; cpp: 3,893; makefile: 2,375; xml: 1,972; yacc: 1,555
file content (50 lines) | stat: -rwxr-xr-x 1,041 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/perl -w

use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
use MBTest tests => 6;

use_ok 'Module::Build';
ensure_blib('Module::Build');

use IO::File;
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);
  my $fh = IO::File->new($file, '>') or die "Can't create $file: $!";
  print $fh "Foo\n";
  $fh->close;
  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) );
}

# cleanup
$dist->remove;