[Commits] [SCM] clawsker branch, master, updated. 1.3.7-17-g15d6fc8
mones at claws-mail.org
mones at claws-mail.org
Fri Dec 22 15:39:53 UTC 2023
The branch, master has been updated
via 15d6fc87807228c5a12fa863b4fec524e3427598 (commit)
from 8b99a8bb83ab5b4b4f5316b181b84427a462c97f (commit)
Summary of changes:
t/backup_resource.t | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
create mode 100644 t/backup_resource.t
- Log -----------------------------------------------------------------
commit 15d6fc87807228c5a12fa863b4fec524e3427598
Author: Ricardo Mones <ricardo at mones.org>
Date: Fri Dec 22 16:39:39 2023 +0100
Test for backup_resource
diff --git a/t/backup_resource.t b/t/backup_resource.t
new file mode 100644
index 0000000..183aa6c
--- /dev/null
+++ b/t/backup_resource.t
@@ -0,0 +1,41 @@
+use 5.010_000;
+use strict;
+use utf8;
+use Glib qw(TRUE FALSE);
+use File::Temp qw(tempdir);
+use File::Spec::Functions;
+use Test::More tests => 7;
+
+require_ok ('Clawsker');
+
+my ($temp, $rc, $rb);
+
+BEGIN {
+ $temp = tempdir (CLEANUP => 1);
+ $rc = catfile ($temp, 'some.rc');
+ $rb = catfile ($temp, 'some.rc.backup');
+ open my $rcf, '>', $rc
+ or die "opening $rc for writing: $!\n";
+ print $rcf <<EORC
+[section]
+key1=value 1
+# some comment
+key2=value 2
+EORC
+}
+
+use Clawsker;
+
+is ( -s $rc, 51, 'resource present' );
+is ( -s $rb, undef, 'backup absent' );
+
+is ( Clawsker::backup_resource($rc), TRUE, 'success' );
+
+is ( -s $rc, undef, 'resource absent' );
+is ( -s $rb, 51, 'backup present' );
+
+local %ENV;
+$ENV{'DISPLAY'} = ''; # avoid error dialogs
+
+is ( Clawsker::backup_resource('missingrc'), FALSE, 'failure' );
+
-----------------------------------------------------------------------
hooks/post-receive
--
Hidden preferences editor for Claws Mail
More information about the Commits
mailing list