diff options
| author | Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> | 2025-02-05 21:16:15 +0200 |
|---|---|---|
| committer | Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> | 2025-02-05 21:16:15 +0200 |
| commit | c0887603c55be3621b2ddcaead6ae7537639f6a7 (patch) | |
| tree | 099110e3f69e6cad03f03e1ae45e7c6c2a2b7a2e /guile | |
| parent | d33adc923ce61f0bacc024824d5db2ee41f1ac08 (diff) | |
guile: avoid body duplication
In message, don't re-fill when unneeded. Add tests.
Fixes #2802.
Diffstat (limited to 'guile')
| -rw-r--r-- | guile/mu-guile-message.cc | 2 | ||||
| -rwxr-xr-x | guile/tests/test-mu-guile.scm | 29 |
2 files changed, 17 insertions, 14 deletions
diff --git a/guile/mu-guile-message.cc b/guile/mu-guile-message.cc index 281ed7c..24223c3 100644 --- a/guile/mu-guile-message.cc +++ b/guile/mu-guile-message.cc @@ -333,7 +333,7 @@ SCM_DEFINE(get_parts, attlist = scm_cons(elm, attlist); } - /* explicitly close the file backend, so we won't run of fds */ + /* explicitly close the file backend, so we won't run out of fds */ msg->unload_mime_message(); return attlist; diff --git a/guile/tests/test-mu-guile.scm b/guile/tests/test-mu-guile.scm index ed00f1e..7926d11 100755 --- a/guile/tests/test-mu-guile.scm +++ b/guile/tests/test-mu-guile.scm @@ -74,10 +74,13 @@ exec guile -e main -s $0 $@ (str-equal-or-exit (mu:subject msg) "Fwd: rfc822") (str-equal-or-exit (mu:to msg) "martin") (str-equal-or-exit (mu:from msg) "foobar <foo@example.com>") + (str-equal-or-exit (mu:body msg) "Hello world, forwarding some RFC822 message\n") (str-equal-or-exit (mu:header msg "X-Mailer") "Ximian Evolution 1.4.5") + ;; issue #2802 + (str-equal-or-exit (mu:body msg) "Hello world, forwarding some RFC822 message\n") (if (not (equal? (mu:priority msg) mu:prio:normal)) - (error-exit "Expected ~A, got ~A" (mu:priority msg) mu:prio:normal))) + (error-exit "Expected ~A, got ~A" (mu:priority msg) mu:prio:normal))) (let ((msg (car (mu:message-list "atoms")))) (str-equal-or-exit (mu:subject msg) "atoms") @@ -85,21 +88,21 @@ exec guile -e main -s $0 $@ (str-equal-or-exit (mu:from msg) "Richard P. Feynman <rpf@example.com>") ;;(str-equal-or-exit (mu:header msg "Content-Transfer-Encoding") "8bit") (str-equal-or-exit (mu:body msg) - (string-join - '("If, in some cataclysm, all scientific knowledge were to be destroyed," - "and only one sentence passed on to the next generation of creatures," - "what statement would contain the most information in the fewest words?" - "I believe it is the atomic hypothesis (or atomic fact, or whatever you" - "wish to call it) that all things are made of atoms — little particles" - "that move around in perpetual motion, attracting each other when they" - "are a little distance apart, but repelling upon being squeezed into" - "one another. In that one sentence you will see an enormous amount of" - "information about the world, if just a little imagination and thinking" - "are applied.\n") "\n")) + (string-join + '("If, in some cataclysm, all scientific knowledge were to be destroyed," + "and only one sentence passed on to the next generation of creatures," + "what statement would contain the most information in the fewest words?" + "I believe it is the atomic hypothesis (or atomic fact, or whatever you" + "wish to call it) that all things are made of atoms — little particles" + "that move around in perpetual motion, attracting each other when they" + "are a little distance apart, but repelling upon being squeezed into" + "one another. In that one sentence you will see an enormous amount of" + "information about the world, if just a little imagination and thinking" + "are applied.\n") "\n")) (str-equal-or-exit (mu:body-txt msg) (mu:body msg)) (let ((got (mu:body-html msg))) (if got - (error-exit "Expected #f, got ~a" got))) + (error-exit "Expected #f, got ~a" got))) (if (not (equal? (mu:priority msg) mu:prio:high)) (error-exit "Expected ~a, got ~a" (mu:priority msg) mu:prio:high)))) |
