t/00-basic.t
changeset 68 8bc711bdd180
parent 58 27440e1334b7
child 71 46ba051d29bd
--- a/t/00-basic.t	Thu Jun 02 20:12:33 2016 +0200
+++ b/t/00-basic.t	Thu Jun 02 22:17:27 2016 +0200
@@ -1,3 +1,22 @@
+use strict;
+use warnings;
 use Test::More qw(no_plan);
+use File::Temp;
 
-use_ok 'Exim::Grey' => qw(unseen);
+use_ok 'Exim::Grey' => qw(unseen)
+  or BAIL_OUT;
+
+my $db = File::Temp->new();
+
+is unseen('a->b', 1, "$db"), 'yes' => 'unseen a->b';
+is unseen('a->b', 1, "$db"), 'yes' => 'unseen a->b';
+
+is unseen('x->y/1.1.1.1', 1, "$db"), 'yes' => 'unseen x->y/1.1.1.1';
+is unseen('x->y/1.1.1.1', 1, "$db"), 'yes' => 'unseen x->y/1.1.1.1';
+
+# sleep
+is unseen('a->b',     0, "$db"), 'no' => 'seen a->b';
+is unseen('x->y/1.1.1.1', 0, "$db"), 'no' => 'seen x->y/1.1.1.1';
+is unseen('x->z/1.1.1.1', 0, "$db"), 'no' => 'seen x->z/1.1.1.1';
+
+is unseen('a->b', 600, "$db"), 'yes' => 'unseen a->b with 600s delay';