[PATCH] test: replace occurrences of $PWD with vars that are more stable

Dmitry Kurochkin dmitry.kurochkin at gmail.com
Wed Feb 1 15:09:39 PST 2012


On Wed,  1 Feb 2012 21:37:21 +0100, Pieter Praet <pieter at praet.org> wrote:
> Thanks to Dmitry Kurochkin <dmitry.kurochkin at gmail.com>
> for pointing this out:  id:"87d39ymyb4.fsf at gmail.com"
> ---

Looks good to me.  Minor comments below.

>  test/emacs |    2 +-
>  test/new   |    6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/test/emacs b/test/emacs
> index 17129b7..9c9d0b4 100755
> --- a/test/emacs
> +++ b/test/emacs
> @@ -266,7 +266,7 @@ From: Notmuch Test Suite <test_suite at notmuchmail.org>
>  To: user at example.com
>  Subject: Re: Testing message sent via SMTP
>  In-Reply-To: <XXX>
> -Fcc: $(pwd)/mail/sent
> +Fcc: ${MAIL_DIR}/sent
>  --text follows this line--
>  On 01 Jan 2000 12:00:00 -0000, Notmuch Test Suite <test_suite at notmuchmail.org> wrote:
>  > This is a test that messages are sent via SMTP
> diff --git a/test/new b/test/new
> index 49f390d..1b24c84 100755
> --- a/test/new
> +++ b/test/new
> @@ -117,10 +117,10 @@ test_expect_equal "$output" "No new mail. Removed 3 messages."
>  test_begin_subtest "New symlink to directory"
>  
>  rm -rf "${MAIL_DIR}"/.notmuch
> -mv "${MAIL_DIR}" "$PWD"/actual_maildir
> +mv "${MAIL_DIR}" "${TMP_DIRECTORY}"/actual_maildir

I would prefer to put the whole second argument inside the quotes, not
just the variable.

>  
>  mkdir "${MAIL_DIR}"
> -ln -s "$PWD"/actual_maildir "${MAIL_DIR}"/symlink
> +ln -s "${TMP_DIRECTORY}"/actual_maildir "${MAIL_DIR}"/symlink

Same.

>  
>  output=$(NOTMUCH_NEW)
>  test_expect_equal "$output" "Added 1 new message to the database."
> @@ -128,7 +128,7 @@ test_expect_equal "$output" "Added 1 new message to the database."
>  
>  test_begin_subtest "New symlink to a file"
>  generate_message
> -external_msg_filename="$PWD"/external/"$(basename "$gen_msg_filename")"
> +external_msg_filename="${TMP_DIRECTORY}"/external/"$(basename "$gen_msg_filename")"

And here as well.  The quotes around "/external/" can just be removed.

Regards,
  Dmitry

>  mkdir -p "$(dirname "$external_msg_filename")"
>  mv "$gen_msg_filename" "$external_msg_filename"
>  ln -s "$external_msg_filename" "$gen_msg_filename"
> -- 
> 1.7.8.1


More information about the notmuch mailing list