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
|
# This file is part of GNU Mailutils -*- Autotest -*-
# Copyright (C) 2018-2025 Free Software Foundation, Inc.
# License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
# This is free software: you are free to change and redistribute it.
# There is NO WARRANTY, to the extent permitted by law.
AT_SETUP([mu-mailbox-append-message])
AT_KEYWORDS([mailbox])
dnl Initial mailbox is modified after append (uidvalidity and uid values
dnl added). Since the exact number of bytes added to each message cannot
dnl be reliably predicted, we remove the line and byte count from comparison.
dnl Additionally, the newly added X-UID header is also removed.
m4_pushdef([MU_GUILE_OUTPUT_FILTER],
[sed -e '/#<message/s/ [0-9][0-9]* [0-9][0-9]*>/>/' \
-e /^X-UID:/d
])
WITH_MAILBOX([spool/mbox1],
[MU_GUILE_CHECK([
(use-modules ((ice-9 binary-ports)))
(let ((mbox (mu-mailbox-open "mbox" "rw")))
(mu-mailbox-append-message mbox (test-message))
(mu-mailbox-close mbox))
(let ((mbox (mu-mailbox-open "mbox" "r")))
(do ((msg (mu-mailbox-first-message mbox) (mu-mailbox-next-message mbox)))
((not (mu-mailbox-more-messages? mbox)))
(display msg)(newline))
(let ((port (mu-message-get-port (mu-mailbox-get-message mbox 6) "r" #t)))
(do ((c (get-u8 port) (get-u8 port)))
((eof-object? c))
(put-u8 (current-output-port) c))
(close port)))],
0,
[#<message "foobar@nonexistent.net" "Fri Dec 28 22:18">
#<message "bar@dontmailme.org" "Fri Dec 28 23:28">
#<message "gray@example.net" "Sat Jul 13 00:43">
#<message "gray@example.net" "Sat Jul 13 00:50">
#<message "gray@example.net" "Sat Jul 13 00:43">
#<message "user@example.org" "Fri Jun 8 14:30">
From: user@example.org
To: someone@example.com
Subject: De omnibus rebus et quibusdam aliis
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
])])
AT_CLEANUP
m4_popdef([MU_GUILE_OUTPUT_FILTER])
dnl depends on:
dnl message-print.at
dnl message-port-read-2.at
dnl mailbox-open.at
dnl mailbox-iterate.at
dnl
|