From: Matthieu Moy <Matthieu.Moy@grenoble-inp•fr>
To: Paul Tan <pyokagan@gmail•com>
Cc: git@vger•kernel.org
Subject: Re: [PATCH 2/2] tests: test credential-store XDG support
Date: Tue, 03 Mar 2015 23:08:47 +0100 [thread overview]
Message-ID: <vpqegp53f9s.fsf@anie.imag.fr> (raw)
In-Reply-To: <1425414299-24000-3-git-send-email-pyokagan@gmail.com> (Paul Tan's message of "Wed, 4 Mar 2015 04:24:59 +0800")
Paul Tan <pyokagan@gmail•com> writes:
> +# Tests for when $XDG_CONFIG_HOME/git/credentials exists but
> +# ~/.git-credentials does not.
As much as possible, put text in the $1 of test_expect_success instead
of comments.
> +rm "$HOME/.git-credentials"
> +mkdir -p "${XDG_CONFIG_HOME:-$HOME/.config}/git"
> +echo '' > "${XDG_CONFIG_HOME:-$HOME/.config}/git/credentials"
> +helper_test store
Don't write code outside test_expect_success (read "Do's, don'ts &
things to keep in mind" in t/README).
> +test_expect_success '~/.git-credentials will not be created if XDG git-credentials exist' '
> + test ! -e "$HOME/.git-credentials"
> +'
test_path_is_missing (see test-lib-functions.sh)
> +echo '' > "$HOME/.git-credentials"
> +echo '' > "${XDG_CONFIG_HOME:-$HOME/.config}/git/credentials"
Not even that outside test_expect_success ;-).
Also, no space after > (Documentation/CodingGuidelines).
> +test_expect_success 'Credentials are stored in XDG file if both XDG and HOME files exist' '
> + check approve store <<-\EOF
> + protocol=https
> + host=example.com
> + username=store-user
> + password=store-pass
> + EOF
> + read contents < "${XDG_CONFIG_HOME:-$HOME/.config}/git/credentials"
> + test ! -z "$contents"
> + read contents < "$HOME/.git-credentials"
No space after <.
> + test -z "$contents"
> +'
> +test_expect_success 'Credentials from XDG file are used if the
> + credentials exist in both XDG and HOME files' '
Blank line between tests please.
> +test_expect_success 'Credentials from both XDG and HOME files meeting the criteria are erased' '
> + check reject $HELPER <<-\EOF &&
> + protocol=https
> + host=example.com
> + EOF
> + read contents < "${XDG_CONFIG_HOME:-$HOME/.config}/git/credentials"
> + test -z "$contents"
> + read contents < "$HOME/.git-credentials"
> + test -z "$contents"
> +'
I'd rather do stg like
echo >expected
test_cmp expected "${XDG_CONFIG_HOME:-$HOME/.config}/git/credentials"
test_cmp expected $HOME/.git-credentials
so that a test failure shows a diagnosis.
Regards,
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
next prev parent reply other threads:[~2015-03-03 22:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-03 20:24 [PATCH] [GSoC15] git-credentials-store: support XDG config dir Paul Tan
2015-03-03 20:24 ` [PATCH 1/2] git-credential-store: " Paul Tan
2015-03-03 22:00 ` Matthieu Moy
2015-03-03 23:01 ` Junio C Hamano
2015-03-04 9:45 ` Jeff King
2015-03-05 6:26 ` Paul Tan
2015-03-05 18:37 ` Junio C Hamano
2015-03-06 9:57 ` Matthieu Moy
2015-03-03 20:24 ` [PATCH 2/2] tests: test credential-store XDG support Paul Tan
2015-03-03 22:08 ` Matthieu Moy [this message]
2015-03-03 23:11 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=vpqegp53f9s.fsf@anie.imag.fr \
--to=matthieu.moy@grenoble-inp$(echo .)fr \
--cc=git@vger$(echo .)kernel.org \
--cc=pyokagan@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox