aboutsummaryrefslogtreecommitdiffstats
path: root/t/lib.t
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2022-06-12 15:11:28 -0400
committerBrian Cully <bjc@kublai.com>2022-06-12 15:13:34 -0400
commit0718a13ba8225c9d180b3207470876d048184310 (patch)
tree33a2080eac997e8304d729d6743ff98103e6eed2 /t/lib.t
parent575c0485c4939922bab313da666a8a18d80c065e (diff)
downloadspamcat-0718a13ba8225c9d180b3207470876d048184310.tar.gz
spamcat-0718a13ba8225c9d180b3207470876d048184310.zip
Allow flagging infinite sends by setting remaing count to -1.
Diffstat (limited to 't/lib.t')
-rw-r--r--t/lib.t23
1 files changed, 14 insertions, 9 deletions
diff --git a/t/lib.t b/t/lib.t
index 395488d..b814c78 100644
--- a/t/lib.t
+++ b/t/lib.t
@@ -1,6 +1,6 @@
# -*- Mode: cperl -*-
-use Test::More tests => 42;
+use Test::More tests => 46;
use strict;
use warnings;
@@ -66,18 +66,23 @@ test_file('wrongdomain', 1);
test_file('nosubj', 1);
test_file('bar', 0);
+$sch->set_count('always-allowed', -1);
+test_file('always-allowed', 1);
+
ok(SpamCat->can('get_table'));
my @rows = @{$sch->get_table()};
-is($#rows, 3);
+is($#rows, 4);
@rows = sort { $a->{sender} cmp $b->{sender} } @rows;
-is($rows[0]->{sender}, 'bar');
-is($rows[0]->{count}, 0);
-is($rows[1]->{sender}, 'foo');
-is($rows[1]->{count}, 16);
-is($rows[2]->{sender}, 'name1');
-is($rows[2]->{count}, 20);
-is($rows[3]->{sender}, 'nosubj');
+is($rows[0]->{sender}, 'always-allowed');
+is($rows[0]->{count}, -1);
+is($rows[1]->{sender}, 'bar');
+is($rows[1]->{count}, 0);
+is($rows[2]->{sender}, 'foo');
+is($rows[2]->{count}, 16);
+is($rows[3]->{sender}, 'name1');
is($rows[3]->{count}, 20);
+is($rows[4]->{sender}, 'nosubj');
+is($rows[4]->{count}, 20);
sub test_file {
my ($filen, $should_exist) = @_;