[Commits] [SCM] clawsker branch, master, updated. 1.3.7-18-ge48dc95

mones at claws-mail.org mones at claws-mail.org
Fri Dec 22 15:44:14 UTC 2023


The branch, master has been updated
       via  e48dc9549ff768c58dc81b78b510faa8fd57c0ff (commit)
      from  15d6fc87807228c5a12fa863b4fec524e3427598 (commit)

Summary of changes:
 t/load_menurc.t | 44 ++++++++++++++++++++++++++++++++++++++++++++
 t/save_menurc.t | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 79 insertions(+)
 create mode 100644 t/load_menurc.t
 create mode 100644 t/save_menurc.t


- Log -----------------------------------------------------------------
commit e48dc9549ff768c58dc81b78b510faa8fd57c0ff
Author: Ricardo Mones <ricardo at mones.org>
Date:   Fri Dec 22 16:44:01 2023 +0100

    Tests for save_menurc and load_menurc

diff --git a/t/load_menurc.t b/t/load_menurc.t
new file mode 100644
index 0000000..41a3218
--- /dev/null
+++ b/t/load_menurc.t
@@ -0,0 +1,44 @@
+use 5.010_000;
+use strict;
+use utf8;
+use File::Temp qw(tempdir);
+use File::Spec::Functions;
+use Glib qw(TRUE FALSE);
+use Test::More tests => 3;
+
+require_ok ('Clawsker');
+
+my ($temp, $rc);
+
+BEGIN {
+    $temp = tempdir (CLEANUP => 1);
+    $rc = catfile ($temp, 'menurc');
+    open my $rcf, '>', $rc
+        or die "opening $rc for writing: $!\n";
+    print $rcf <<EORC
+; (gtk_accel_path "<Actions>/Menu/Edit/One" "")
+(gtk_accel_path "<Actions>/Menu/Edit/Two" "<Primary>t")
+EORC
+}
+
+use Clawsker;
+
+is ( -s $rc, 104, 'resource present' );
+
+my %expected = (
+    'Actions' => {
+        '/Menu/Edit/One' => {
+            'key' => '""', 'enabled' => FALSE, 'line' => 0,
+        },
+        '/Menu/Edit/Two' => {
+            'key' => '"<Primary>t"', 'enabled' => TRUE, 'line' => 1,
+        },
+    },
+);
+
+is_deeply (
+    Clawsker::load_menurc($rc),
+    \%expected,
+    'data loaded'
+);
+
diff --git a/t/save_menurc.t b/t/save_menurc.t
new file mode 100644
index 0000000..14b6644
--- /dev/null
+++ b/t/save_menurc.t
@@ -0,0 +1,35 @@
+use 5.010_000;
+use strict;
+use utf8;
+use File::Temp qw(tempdir);
+use File::Spec::Functions;
+use Glib qw(TRUE FALSE);
+use Test::More tests => 3;
+
+require_ok ('Clawsker');
+
+my ($temp, %data, $rc);
+
+BEGIN {
+    $temp = tempdir (CLEANUP => 1);
+    $rc = catfile ($temp, 'menurc');
+    %data = (
+        'Actions' => {
+            '/Menu/Edit/One' => {
+                'key' => '""', 'enabled' => FALSE, 'line' => 0,
+            },
+            '/Menu/Edit/Two' => {
+                'key' => '"<Primary>t"', 'enabled' => TRUE, 'line' => 1,
+            },
+        },
+    );
+}
+
+use Clawsker;
+
+is ( -s $rc, undef, 'resource absent' );
+
+Clawsker::save_menurc($rc, \%data);
+
+is ( -s $rc, 104 + 107, 'resource created' );
+

-----------------------------------------------------------------------


hooks/post-receive
-- 
Hidden preferences editor for Claws Mail


More information about the Commits mailing list