aboutsummaryrefslogtreecommitdiff
path: root/t/00simple.t
blob: 10faef6a0428822b60cec551b1888dfb173a54f9 (plain)
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
# -*- perl -*-
use lib qw(t lib);
use strict;
use TestBackup;
use File::BackupCopy qw(backup_copy_simple);
    
plan test => 9;

makefile('a');

my $name = backup_copy_simple('a');
ok($name, 'a~');
fileok('a', $name);

$name = backup_copy_simple('a');
ok($name, 'a~');
fileok('a', $name);

mkdir "subdir";
$name = backup_copy_simple('a', dir => 'subdir');
ok($name, File::Spec->catfile('subdir','a~'));
fileok('a', $name);

eval {
    backup_copy_simple('a', dir => 'nonexisting');
};
ok(!!$@);

$name = backup_copy_simple('a', dir => 'nonexisting', error => \my $err);
ok(!defined($name));
ok(defined($err) && $err ne '');

# chmod 0, 'subdir';
# $name = backup_copy_simple('a', dir => 'subdir', error => \$err);
# ok(!defined($name));
# print "$err\n";

Return to:

Send suggestions and report system problems to the System administrator.