git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Doan Tran Cong Danh <congdanhqx@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/2] t3301: test diagnose messages for too few/many paramters
Date: Fri, 18 Oct 2019 09:38:27 +0900	[thread overview]
Message-ID: <xmqqeeza7urg.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20191016051841.19896-1-congdanhqx@gmail.com> (Doan Tran Cong Danh's message of "Wed, 16 Oct 2019 12:18:40 +0700")

Doan Tran Cong Danh <congdanhqx@gmail.com> writes:

> If we accidentally lifted the check inside our code base, the test may
> still failed because the provided parameter is not a valid ref.

Makes sense.  Another option would be to use a valid ref to make
sure there are no other possible reason for the command to fail,
which would make the test robust against us accidentally switching
the order of the check to see if they are refs first and then
complain about too many or too few arguments ;-)  But I think what
we have here is fine as-is (I'll copy-edit the proposed log message
for grammos, though).

Thanks.

>
> Correct it.
>
> Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
> ---
>  t/t3301-notes.sh | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh
> index d3fa298c6a..d7767e4438 100755
> --- a/t/t3301-notes.sh
> +++ b/t/t3301-notes.sh
> @@ -1167,8 +1167,10 @@ test_expect_success 'GIT_NOTES_REWRITE_REF overrides config' '
>  '
>  
>  test_expect_success 'git notes copy diagnoses too many or too few parameters' '
> -	test_must_fail git notes copy &&
> -	test_must_fail git notes copy one two three
> +	test_must_fail git notes copy 2>error &&
> +	test_i18ngrep "too few parameters" error &&
> +	test_must_fail git notes copy one two three 2>error &&
> +	test_i18ngrep "too many parameters" error
>  '
>  
>  test_expect_success 'git notes get-ref expands refs/heads/master to refs/notes/refs/heads/master' '

      parent reply	other threads:[~2019-10-18  0:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-15 16:36 [PATCH 0/1] Allow default value for target of git-notes copy Doan Tran Cong Danh
2019-10-15 16:36 ` [PATCH 1/1] notes: copy notes to HEAD by default Doan Tran Cong Danh
2019-10-16  2:01   ` Junio C Hamano
2019-10-16  5:17     ` Danh Doan
2019-10-16  5:18 ` [PATCH 1/2] t3301: test diagnose messages for too few/many paramters Doan Tran Cong Danh
2019-10-16  5:18   ` [PATCH 2/2] notes: fix minimum number of parameters to "copy" subcommand Doan Tran Cong Danh
2019-10-18  0:44     ` Junio C Hamano
2019-10-18  0:38   ` Junio C Hamano [this message]

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=xmqqeeza7urg.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=congdanhqx@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).