summaryrefslogtreecommitdiff
path: root/t/email.t
blob: f2208a69577c7caa16a360e2a3e170c5b4038d0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!perl6 
use v6.d.PREVIEW;
use Test;
use MaildirIndexer::Email;
 
subtest 'no values' => {
    my $email = MaildirIndexer::Email.new(
        headers => %(),
        body => '',
    );
 
    is-deeply $email.message-id'''message id should parse';
    is-deeply $email.refsqw[]'refs should parse';
}
 
subtest 'bad values' => {
    my $email = MaildirIndexer::Email.new(
        headers => %(
            message-id => 'some stuff here',
            in-reply-to => 'none',
            references => 'bad garbage',
        ),
        body => '',
    );
 
    is-deeply $email.message-id'''message id should parse';
    is-deeply $email.refsqw[]'refs should parse';
}
 
subtest 'all values' => {
    my $email = MaildirIndexer::Email.new(
        headers => %(
            message-id => 'some <stuff> here',
            in-reply-to => '<one>',
            references => 'bad <two> garbage <three>',
        ),
        body => '',
    );
 
    is-deeply $email.message-id'stuff''message id should parse';
    is-deeply $email.refsqw[one three two]'refs should parse';
}
 
done-testing;