discussion and development of piem
 help / color / mirror / code / Atom feed
blob f2340d318070ccdb89cd807e3ba066fe6a746b95 2046 bytes (raw)
name: tests/piem-rmail-tests.el 	 # note: path name is non-authoritative(*)

 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
 
;;; piem-rmail-tests.el --- tests for piem-rmail  -*- lexical-binding: t; -*-

;; Copyright (C) 2021  all contributors <piem@inbox.kyleam.com>

;; Author: Kyle Meyer <kyle@kyleam.com>

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <https://www.gnu.org/licenses/>.

;;; Code:

(require 'ert)
(require 'piem-rmail)

(ert-deftest piem-rmail-get-inbox ()
  (let ((piem-inboxes '(("foo" :address "i@inbox.example.com")))
        (mbox-text "\
From mboxrd@z Thu Jan  1 00:00:00 1970
From: A <a@example.com>
To: i@inbox.example.com
Subject: test
Date: Sun, 23 May 2021 02:26:01 -0400
Message-ID: <123@example.com>

test body

From mboxrd@z Thu Jan  1 00:00:00 1970
From: b <b@example.com>
To: A <a@example.com>
Cc: i@inbox.example.com
Subject: Re: test
Date: Sun, 23 May 2021 02:26:51 -0400
Message-Id: <456@example.com>
In-Reply-To: <123@example.com>
References: <123@example.com>

> test body

no thanks
"))
    (should
     (equal "foo"
            (with-temp-buffer
              (insert mbox-text)
              (rmail-mode)
              (piem-rmail-get-inbox))))
    (should
     (equal (list "123@example.com" "456@example.com")
            (with-temp-buffer
              (insert mbox-text)
              (rmail-mode)
              (rmail-first-message)
              (list (piem-rmail-get-mid)
                    (progn
                      (rmail-next-message 1)
                      (piem-rmail-get-mid))))))))

(provide 'piem-rmail-tests)
;;; piem-rmail-tests.el ends here

debug log:

solving f2340d3 ...
found f2340d3 in https://inbox.kyleam.com/piem/20210527213001.5265-1-kyle@kyleam.com/

applying [1/1] https://inbox.kyleam.com/piem/20210527213001.5265-1-kyle@kyleam.com/
diff --git a/tests/piem-rmail-tests.el b/tests/piem-rmail-tests.el
new file mode 100644
index 0000000..f2340d3

Checking patch tests/piem-rmail-tests.el...
Applied patch tests/piem-rmail-tests.el cleanly.

index at:
100644 f2340d318070ccdb89cd807e3ba066fe6a746b95	tests/piem-rmail-tests.el

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.kyleam.com/piem/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).