[PATCH] test-lib.sh: "tidied" emacs_deliver_message ()
Tomi Ollila
tomi.ollila at iki.fi
Thu May 16 13:43:51 PDT 2019
Added initialization and checking of smtp_dummy_port
like it was done with smtp_dummy_pid.
Made those function-local variables.
One 8 spaces to tab consistency conversion.
And last, but definitely not least; while doing above
noticed that there were quite a few double-quoted strings
where $@ was in the middle of it -- replaced those with $*
for robustness ("...$@..." expands params to separate words,
"...$*..." params expands to single word).
---
man bash, search for 'double-quoted' for more details.
example:
$ fn () { printf %s\\n "foo $@ bar"; }
$ fn 1 2 3
foo 1
2
3 bar
test/test-lib.sh | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 507886ba..ed7f6aa7 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -317,14 +317,15 @@ emacs_deliver_message ()
shift 2
# before we can send a message, we have to prepare the FCC maildir
mkdir -p "$MAIL_DIR"/sent/{cur,new,tmp}
- # eval'ing smtp-dummy --background will set smtp_dummy_pid
- smtp_dummy_pid=
+ # eval'ing smtp-dummy --background will set smtp_dummy_pid and -_port
+ local smtp_dummy_pid= smtp_dummy_port=
eval `$TEST_DIRECTORY/smtp-dummy --background sent_message`
test -n "$smtp_dummy_pid" || return 1
+ test -n "$smtp_dummy_port" || return 1
test_emacs \
"(let ((message-send-mail-function 'message-smtpmail-send-it)
- (mail-host-address \"example.com\")
+ (mail-host-address \"example.com\")
(smtpmail-smtp-server \"localhost\")
(smtpmail-smtp-service \"${smtp_dummy_port}\"))
(notmuch-mua-mail)
@@ -334,7 +335,7 @@ emacs_deliver_message ()
(insert \"${subject}\")
(message-goto-body)
(insert \"${body}\")
- $@
+ $*
(notmuch-mua-send-and-exit))"
# In case message was sent properly, client waits for confirmation
@@ -378,7 +379,7 @@ emacs_fcc_message ()
(insert \"${subject}\")
(message-goto-body)
(insert \"${body}\")
- $@
+ $*
(notmuch-mua-send-and-exit))" || return 1
notmuch new $nmn_args >/dev/null
}
@@ -996,7 +997,7 @@ test_emacs () {
rm -f OUTPUT
touch OUTPUT
- ${TEST_EMACSCLIENT} --socket-name="$EMACS_SERVER" --eval "(notmuch-test-progn $@)"
+ ${TEST_EMACSCLIENT} --socket-name="$EMACS_SERVER" --eval "(notmuch-test-progn $*)"
}
test_python() {
--
2.20.1
More information about the notmuch
mailing list