diff options
Diffstat (limited to 't')
-rw-r--r-- | t/srs.t | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -0,0 +1,32 @@ +use strict; +use warnings; + +use Test::More;# tests => 8; + +BEGIN { + use_ok 'Spline::Srs', qw( + check_exclude + srs_forward + srs_reverse + ) or BAIL_OUT; +} + +# Testing ignores +is(check_exclude('test@example.com', 'example.com'), 1, 'Ignore matching domain'); +is(check_exclude('test@example.de', 'example.com'), 0, 'Do not ignore non-matching domain'); +is(check_exclude('test@test.example.com', 'example.com'), 0, 'Do not ignore sub-domain'); +is(check_exclude('test@test.example.com', '.example.com'), 1, 'Ignore sub-domain if requested'); + +# SRS Forward +my $result = srs_forward('alex@example.com'); +isnt($result, undef, 'Not undef'); +like($result, qr/^SRS0[+=-]/, 'SRS0 Prefix'); +like($result, qr/\@spline\.inf\.fu-berlin\.de$/, 'Rewrite to spline-Domain'); + +# SRS Reverse +is(Spline::Srs::srs_forward('alex@domain.invalid'), 'SRS0=7tXNg=SJ=domain.invalid=alex@spline.inf.fu-berlin.de', 'Forward'); +is(Spline::Srs::srs_reverse('SRS0=7tXNg=SJ=domain.invalid=alex@spline.inf.fu-berlin.de'), 'alex@domain.invalid', 'Reverse'); + +done_testing; + +# vim: set et ts=4: |