summaryrefslogtreecommitdiffstats
path: root/t/srs.t
diff options
context:
space:
mode:
Diffstat (limited to 't/srs.t')
-rw-r--r--t/srs.t32
1 files changed, 32 insertions, 0 deletions
diff --git a/t/srs.t b/t/srs.t
new file mode 100644
index 0000000..824d8e9
--- /dev/null
+++ b/t/srs.t
@@ -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: