summaryrefslogtreecommitdiff
path: root/t/lib
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2019-12-28 14:23:48 +0000
committerdakkar <dakkar@thenautilus.net>2019-12-28 14:23:48 +0000
commit906180e94bcc5dc09c146c1041df0f135e11b89b (patch)
treeace8cc12b9d0bdc9518eac14030dd34537ab8f3a /t/lib
parentmake things faster by doing more work (?!??!) (diff)
downloadMaildirIndexer-906180e94bcc5dc09c146c1041df0f135e11b89b.tar.gz
MaildirIndexer-906180e94bcc5dc09c146c1041df0f135e11b89b.tar.bz2
MaildirIndexer-906180e94bcc5dc09c146c1041df0f135e11b89b.zip
test for Store
Diffstat (limited to 't/lib')
-rw-r--r--t/lib/TestIndex.pm632
1 files changed, 32 insertions, 0 deletions
diff --git a/t/lib/TestIndex.pm6 b/t/lib/TestIndex.pm6
new file mode 100644
index 0000000..730ee92
--- /dev/null
+++ b/t/lib/TestIndex.pm6
@@ -0,0 +1,32 @@
+use v6.d;
+use MaildirIndexer::Index;
+
+unit class TestIndex does MaildirIndexer::Index;
+
+has %.mails;
+has atomicint $!seen = 0;
+has Int $.expect;
+has $.seen-all;
+has $!seen-all-vow;
+
+method set-expect(Int:D $!expect) {
+ $!seen ⚛= 0;
+ $!seen-all = Promise.new;
+ $!seen-all-vow = $!seen-all.vow;
+}
+
+method add-mail(MaildirIndexer::Email:D $email, Str:D $mailbox --> Nil) {
+ %.mails{$mailbox}{$email.path}=1;
+ ++⚛$!seen;
+ if ($!seen == $!expect) {
+ $!seen-all-vow.keep(True)
+ }
+}
+
+method del-path(IO:D $path, Str:D $mailbox --> Nil) {
+ %.mails{$mailbox}{$path}:delete;
+}
+
+method mailbox-for-email(MaildirIndexer::Email:D $email --> Str) {
+ return 'foo'
+}