[Commits] [SCM] clawsker branch, master, updated. 1.3.8-7-ge06a5b9

mones at claws-mail.org mones at claws-mail.org
Fri Aug 23 15:34:52 UTC 2024


The branch, master has been updated
       via  e06a5b9ac314190e5777c2494be342990032ae88 (commit)
      from  827786bc9fe470ee61e72c9023a1c11e5a686638 (commit)

Summary of changes:
 t/opt_alternate_config_dir.t | 22 ++++++++++++++++++++++
 t/opt_clawsrc.t              | 33 +++++++++++++++++++++++++++++++++
 t/opt_use_claws_version.t    | 19 +++++++++++++++++++
 3 files changed, 74 insertions(+)
 create mode 100644 t/opt_alternate_config_dir.t
 create mode 100644 t/opt_clawsrc.t
 create mode 100644 t/opt_use_claws_version.t


- Log -----------------------------------------------------------------
commit e06a5b9ac314190e5777c2494be342990032ae88
Author: Ricardo Mones <ricardo at mones.org>
Date:   Fri Aug 23 17:34:39 2024 +0200

    Add tests for option handlers

diff --git a/t/opt_alternate_config_dir.t b/t/opt_alternate_config_dir.t
new file mode 100644
index 0000000..dc142f9
--- /dev/null
+++ b/t/opt_alternate_config_dir.t
@@ -0,0 +1,22 @@
+use 5.010_000;
+use strict;
+use utf8;
+use Glib qw(TRUE FALSE);
+use Test::More tests => 7;
+use Test::Exception;
+
+require_ok ('Clawsker');
+
+use Clawsker;
+
+ok ( defined &Clawsker::opt_alternate_config_dir, 'has function' );
+
+like ( $Clawsker::CONFIGDIR, qr{^.*\.claws-mail$}, 'init: dir' );
+is ( $Clawsker::ALTCONFIGDIR, FALSE, 'init: alt' );
+
+dies_ok { Clawsker::opt_alternate_config_dir('', 'invalid') } 'invalid dir';
+
+Clawsker::opt_alternate_config_dir('', '.');
+
+is ( $Clawsker::CONFIGDIR, '.', 'valid: dir' );
+is ( $Clawsker::ALTCONFIGDIR, TRUE, 'valid: alt' );
diff --git a/t/opt_clawsrc.t b/t/opt_clawsrc.t
new file mode 100644
index 0000000..db96564
--- /dev/null
+++ b/t/opt_clawsrc.t
@@ -0,0 +1,33 @@
+use 5.010_000;
+use strict;
+use utf8;
+use Test::More tests => 7;
+use Test::Exception;
+use File::Spec::Functions;
+use File::Temp qw(tempdir);
+
+require_ok ('Clawsker');
+
+my ($temp, $rc);
+
+BEGIN {
+  $temp = tempdir (CLEANUP => 1);
+  $rc = catfile ($temp, 'alternaterc');
+  open my $rcf, '>', $rc
+    or die "opening $rc for writing: $!\n";
+  close $rcf;
+}
+
+use Clawsker;
+
+ok ( defined &Clawsker::opt_clawsrc, 'has function' );
+
+is ( $Clawsker::CONFIGRC, 'clawsrc', 'init: rc' );
+like ( $Clawsker::CONFIGDIR, qr{^.*\.claws-mail$}, 'init: dir' );
+
+dies_ok { Clawsker::opt_clawsrc('', 'invalidrc') } 'invalid';
+
+Clawsker::opt_clawsrc('', $rc);
+
+is ( $Clawsker::CONFIGRC, 'alternaterc', 'init: rc' );
+is ( $Clawsker::CONFIGDIR, "$temp/", 'init: dir' );
diff --git a/t/opt_use_claws_version.t b/t/opt_use_claws_version.t
new file mode 100644
index 0000000..95540ec
--- /dev/null
+++ b/t/opt_use_claws_version.t
@@ -0,0 +1,19 @@
+use 5.010_000;
+use strict;
+use utf8;
+use Test::More tests => 5;
+use Test::Exception;
+
+require_ok ('Clawsker');
+
+use Clawsker;
+
+ok ( defined &Clawsker::opt_use_claws_version, 'has function' );
+
+is ( $Clawsker::CLAWSV, undef, 'not set' );
+
+dies_ok { Clawsker::opt_use_claws_version('', 'version') } 'invalid';
+
+Clawsker::opt_use_claws_version('', '1.2.3');
+
+is ( $Clawsker::CLAWSV, '1.2.3', 'is set' );

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


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


More information about the Commits mailing list