From 5c3fa491eebc690fbac8a963996a0244882813c7 Mon Sep 17 00:00:00 2001 From: "Jannis M. Hoffmann" Date: Fri, 22 Apr 2022 19:31:45 +0200 Subject: refactored plugin I18N2 added actions script --- t/I18N2.t | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 t/I18N2.t (limited to 't/I18N2.t') diff --git a/t/I18N2.t b/t/I18N2.t new file mode 100644 index 0000000..f9c6285 --- /dev/null +++ b/t/I18N2.t @@ -0,0 +1,31 @@ +use v5.22; +use warnings; +use utf8; + +use Test::More; + +use JWebmail::Plugin::I18N2; + +*add_option = \&JWebmail::Plugin::I18N2::Match::__add_option_no_override; + + +subtest 'add_option' => sub { + + is_deeply(add_option(a => 1, {}), {a => 1}, "empty-hash"); + is_deeply(add_option(a => 5, {a => 1}), {a => 1}, "no-add-hash"); + is_deeply(add_option(b => 2, {a => 1}), {a => 1, b => 2}, "add-hash"); + + is_deeply([add_option(a => 1, 'arg', {})], ['arg', {a => 1}], "empty-arg-hash"); + is_deeply([add_option(a => 5, 'arg', {a => 1})], ['arg', {a => 1}], "no-add-arg-hash"); + is_deeply([add_option(b => 2, 'arg', {a => 1})], ['arg', {a => 1, b => 2}], "add-arg-hash"); + + is_deeply([add_option(a => 1)], [a => 1], "empty-array"); + is_deeply([add_option(a => 5, a => 1)], [a => 1], "no-add-array"); + eq_set([add_option(b => 2, a => 1)], [a => 1, b => 2], "add-array"); + + is_deeply([add_option(a => 1, 'arg')], ['arg', a => 1], "empty-arg-array"); + is_deeply([add_option(a => 5, 'arg', a => 1)], ['arg', a => 1], "no-add-arg-array"); + eq_set([add_option(b => 2, 'arg', a => 1)], ['arg', a => 1, b => 2], "add-arg-array"); +}; + +done_testing; -- cgit v1.2.3