aboutsummaryrefslogtreecommitdiff
path: root/t/01numbered.t
blob: 50572c8e3c1277cacc13134fc4cc4a8ec5e13f51 (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
# -*- perl -*-
use lib qw(t lib);
use strict;
use TestBackup;
use File::BackupCopy qw(backup_copy_numbered);
    
plan test => 9;

makefile('a');

my $name = backup_copy_numbered('a');
ok($name, 'a.~1~');
fileok('a', $name);

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

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

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

Return to:

Send suggestions and report system problems to the System administrator.