unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] test-lib.sh: "tidied" emacs_deliver_message ()
@ 2019-05-16 20:43 Tomi Ollila
  2019-05-23 11:41 ` David Bremner
  0 siblings, 1 reply; 2+ messages in thread
From: Tomi Ollila @ 2019-05-16 20:43 UTC (permalink / raw)
  To: notmuch; +Cc: tomi.ollila

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] test-lib.sh: "tidied" emacs_deliver_message ()
  2019-05-16 20:43 [PATCH] test-lib.sh: "tidied" emacs_deliver_message () Tomi Ollila
@ 2019-05-23 11:41 ` David Bremner
  0 siblings, 0 replies; 2+ messages in thread
From: David Bremner @ 2019-05-23 11:41 UTC (permalink / raw)
  To: Tomi Ollila, notmuch; +Cc: tomi.ollila

Tomi Ollila <tomi.ollila@iki.fi> writes:

> Added initialization and checking of smtp_dummy_port
> like it was done with smtp_dummy_pid.
>

pushed to master.

d

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-23 11:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-16 20:43 [PATCH] test-lib.sh: "tidied" emacs_deliver_message () Tomi Ollila
2019-05-23 11:41 ` David Bremner

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

	https://yhetil.org/notmuch.git/

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).