]> git.notmuchmail.org Git - notmuch/commitdiff
test-lib.sh: "tidied" emacs_deliver_message ()
authorTomi Ollila <tomi.ollila@iki.fi>
Thu, 16 May 2019 20:43:51 +0000 (23:43 +0300)
committerDavid Bremner <david@tethera.net>
Thu, 23 May 2019 11:00:13 +0000 (08:00 -0300)
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).

test/test-lib.sh

index 7b49fc9799dac7ed371e4214193d74212cfb84da..068e1029e5f30272883c53556d89e3844e278c71 100644 (file)
@@ -320,14 +320,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)
@@ -337,7 +338,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
@@ -381,7 +382,7 @@ emacs_fcc_message ()
           (insert \"${subject}\")
           (message-goto-body)
           (insert \"${body}\")
-          $@
+          $*
           (notmuch-mua-send-and-exit))" || return 1
     notmuch new $nmn_args >/dev/null
 }
@@ -999,7 +1000,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() {