diff options
Diffstat (limited to 't')
-rw-r--r-- | t/tests/sietima/subscriber.t | 46 |
1 files changed, 33 insertions, 13 deletions
diff --git a/t/tests/sietima/subscriber.t b/t/tests/sietima/subscriber.t index 1f4c608..5a06bba 100644 --- a/t/tests/sietima/subscriber.t +++ b/t/tests/sietima/subscriber.t @@ -6,19 +6,39 @@ use Test2::Bundle::Extended; use Test2::Plugin::DieOnFail; use Sietima::Subscriber; -my $s = Sietima::Subscriber->new( - raw_address => 'Gino (pino) <gino@pino.example.com>', -); +subtest 'simple' => sub { + my $s = Sietima::Subscriber->new( + raw_address => 'Gino (pino) <gino@pino.example.com>', + ); -is( - $s, - object { - call address => 'gino@pino.example.com'; - call name => 'Gino'; - call original => 'Gino (pino) <gino@pino.example.com>'; - call prefs => {}; - }, - 'construction and delegation should work', -); + is( + $s, + object { + call address => 'gino@pino.example.com'; + call name => 'Gino'; + call original => 'Gino (pino) <gino@pino.example.com>'; + call prefs => {}; + }, + 'construction and delegation should work', + ); +}; + +subtest 'aliases' => sub { + my $s = Sietima::Subscriber->new( + raw_address => 'Gino (pino) <gino@pino.example.com>', + aliases => [qw(also-gino@pino.example.com maybe-gino@rino.example.com)], + ); + + is( + $s, + object { + for my $a (qw(gino@pino also-gino@pino maybe-gino@rino)) { + call [match => "${a}.example.com"] => T(); + } + }, + 'all addresses should ->match()', + ); + +}; done_testing; |