diff options
author | Jannis M. Hoffmann <jannis.hoffmann@rwth-aachen.de> | 2022-04-22 19:31:45 +0200 |
---|---|---|
committer | Jannis M. Hoffmann <jannis.hoffmann@rwth-aachen.de> | 2022-04-22 19:31:45 +0200 |
commit | 5c3fa491eebc690fbac8a963996a0244882813c7 (patch) | |
tree | 784623eb6b652ff98473549c48c7a997898fc38e /t | |
parent | e1bafc13858b5c72a7584c52d3d9d6d597d39e6b (diff) |
refactored plugin I18N2
added actions script
Diffstat (limited to 't')
-rw-r--r-- | t/I18N2.t | 31 |
1 files changed, 31 insertions, 0 deletions
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; |