App-bk
view release on metacpan or search on metacpan
t/multi_files.t view on Meta::CPAN
$!,
'got correct backup filename'
);
is( $trap->exit, undef, 'correct exit' );
is( $trap->leaveby, 'return', 'returned correctly' );
is( $trap->die, undef, 'no death output' );
is( $result, 1, 'got correct return value' );
my $file1_last_backup_file = App::bk::get_last_backup( $Bin, 'file1.txt' );
note( 'Amending file ', $file1_last_backup_file );
chmod 0644, $file1_last_backup_file || BAIL_OUT("Could not reset perms on $file1_last_backup_file:: ". $!);
open(my $fh, '>>', $file1_last_backup_file) || BAIL_OUT("Could not open $file1_last_backup_file: ". $!);
print $fh ' Amended test',$/ || BAIL_OUT("Could not write to $file1_last_backup_file: ", $!);
close($fh) || BAIL_OUT("Could not close $file1_last_backup_file: ". $!);
my $file2_last_backup_file = App::bk::get_last_backup( $Bin, 'file2.txt' );
note( 'Amending file ', $file2_last_backup_file );
chmod 0644, $file2_last_backup_file || BAIL_OUT("Could not reset perms on $file2_last_backup_file:: ". $!);
open($fh, '>>', $file2_last_backup_file) || BAIL_OUT("Could not open $file2_last_backup_file: ". $!);
print $fh ' Amended test',$/ || BAIL_OUT("Could not write to $file2_last_backup_file: ". $!);
close($fh) || BAIL_OUT("Could not close $file2_last_backup_file: ". $!);
$result = trap { App::bk::backup_files(); };
is( $trap->stderr, '', 'no stderr output' );
like(
$trap->stdout,
qr!Backed up file1.txt to ./file1.txt.([\w-]+\.)?\d{8}\.\d{6}
t/one_file.t view on Meta::CPAN
'correctly got no change'
);
is( $trap->exit, undef, 'correct exit' );
is( $trap->leaveby, 'return', 'returned correctly' );
is( $trap->die, undef, 'no death output' );
is( $result, 1, 'got correct return value' );
my $last_backup_file = App::bk::get_last_backup( $Bin, 'file1.txt' );
note( 'Amending file ', $last_backup_file );
# have to reset perms on some systems as the backed up file might be RO
chmod 0644, $last_backup_file || BAIL_OUT("Could not reset perms on $last_backup_file:: ". $!);
open(my $fh, '>>', $last_backup_file) || BAIL_OUT("Could not open $last_backup_file: ". $!);
print $fh ' Amended test',$/ || BAIL_OUT("Could not write to $last_backup_file: ". $!);
close($fh) || BAIL_OUT("Could not close $last_backup_file: ". $!);
$result = trap { App::bk::backup_files(); };
is( $trap->stderr, '', 'no stderr output' );
like(
$trap->stdout,
qr!Backed up file1.txt to ./file1.txt.([\w-]+\.)?\d{8}\.\d{6}\s$!,
( run in 0.390 second using v1.01-cache-2.11-cpan-496ff517765 )