aboutsummaryrefslogtreecommitdiff
path: root/t/02auto.t
diff options
context:
space:
mode:
Diffstat (limited to 't/02auto.t')
-rw-r--r--t/02auto.t24
1 files changed, 23 insertions, 1 deletions
diff --git a/t/02auto.t b/t/02auto.t
index 03f842a..4717020 100644
--- a/t/02auto.t
+++ b/t/02auto.t
@@ -4,7 +4,7 @@ use strict;
use TestBackup;
use File::Backup qw(backup_numbered backup_auto);
-plan test => 6;
+plan test => 16;
makefile('a');
@@ -20,3 +20,25 @@ $name = backup_auto('a');
ok($name, 'a.~2~');
fileok('a', $name);
+mkdir "subdir";
+$name = backup_auto('a', dir => 'subdir');
+ok($name, File::Spec->catfile('subdir','a~'));
+fileok('a', $name);
+
+$name = backup_auto('a', dir => 'subdir');
+ok($name, File::Spec->catfile('subdir','a~'));
+fileok('a', $name);
+
+ok(open(FH, '>', File::Spec->catfile('subdir','a.~1~')));
+$name = backup_auto('a', dir => 'subdir');
+ok($name, File::Spec->catfile('subdir','a.~2~'));
+fileok('a', $name);
+
+eval {
+ backup_auto('a', dir => 'nonexisting');
+};
+ok(!!$@);
+
+$name = backup_auto('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.