File: mailbox.scm

package info (click to toggle)
scmail 1.3-4.1
  • links: PTS
  • area: main
  • in suites: bullseye, forky, sid, trixie
  • size: 592 kB
  • sloc: lisp: 1,535; sh: 178; makefile: 145
file content (50 lines) | stat: -rw-r--r-- 1,289 bytes parent folder | download | duplicates (4)
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
(use gauche.test)
(use srfi-1)

(test-start "scmail.mailbox")
(use scmail.mailbox)
(use scmail.mh)
(use scmail.maildir)

(test-module 'scmail.mailbox)

(define mailbox-table
  '((mh      #f "Mail"    "inbox")
    (maildir #f "Maildir" "")))

(define (mailbox-list)
  (map second mailbox-table))

(define type-of     first)
(define object-of   second)
(define location-of third)
(define inbox-of    fourth)

(test "make-scmail-mailbox" #t
      (lambda ()
        (for-each (lambda (mailbox)
                    (let ((type (type-of mailbox))
                          (location (location-of  mailbox)))
                      (set-car! (cdr mailbox)
                                (make-scmail-mailbox type location))))
                  mailbox-table)
        (with-error-handler
         (lambda (e)
           ;; error should be occurred
           (print (ref e 'message))
           #t)
         (lambda ()
           (set! xxx-mailbox (make-scmail-mailbox 'xxx "/dev/null"))
           #f))))

(test "scmail-mailbox-mail-list" #t
      (lambda ()
        (every
         (lambda (mailbox)
           (= (length (scmail-mailbox-mail-list (object-of mailbox)
                                                (inbox-of mailbox)))
              8))
         mailbox-table)))


(test-end)