git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3 2/3] t4203: Use test-lib.sh definitions

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 25, 2019, 06:18 UTC
Message-ID
<xmqq4kzxcpqm.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20191024233617.18716-3-prarit@redhat.com>
Prarit Bhargava <prarit@redhat.com> writes:
Show 47 quoted lines
> Use name and email definitions from test-lib.sh.
>
> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
> ---
>  t/t4203-mailmap.sh | 94 +++++++++++++++++++++++-----------------------
>  1 file changed, 47 insertions(+), 47 deletions(-)
>
> diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh
> index 918ada69eb96..e8f9c0f5bc8c 100755
> --- a/t/t4203-mailmap.sh
> +++ b/t/t4203-mailmap.sh
> @@ -13,8 +13,8 @@ fuzz_blame () {
>  }
>  
>  test_expect_success setup '
> -	cat >contacts <<-\EOF &&
> -	A U Thor <author@example.com>
> +	cat >contacts <<- EOF &&
> +	$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
>  	nick1 <bugs@company.xx>
>  	EOF
>  
> @@ -33,19 +33,19 @@ test_expect_success 'check-mailmap no arguments' '
>  '
>  
>  test_expect_success 'check-mailmap arguments' '
> -	cat >expect <<-\EOF &&
> -	A U Thor <author@example.com>
> +	cat >expect <<- EOF &&
> +	$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
>  	nick1 <bugs@company.xx>
>  	EOF
>  	git check-mailmap \
> -		"A U Thor <author@example.com>" \
> +		"$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>" \
>  		"nick1 <bugs@company.xx>" >actual &&
>  	test_cmp expect actual
>  '
>  
>  test_expect_success 'check-mailmap --stdin' '
> -	cat >expect <<-\EOF &&
> -	A U Thor <author@example.com>
> +	cat >expect <<- EOF &&
> +	$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
>  	nick1 <bugs@company.xx>
>  	EOF
>  	git check-mailmap --stdin <contacts >actual &&

Strictly speaking, the above is different from the ones that appear in the rest of this patch and the ones in step 1/3.

The reason why you need to expect "author@example.com" in the output of check-mailmap is only because the same hardcoded string is used in the setup step of this test.

The remainder of this file and step 1/3 are quite different and are all good changes. The commit the data comes from gets created with the value that happens to be set to GIT_AUTHOR_NAME in test-lib---if the assigned value changes over there, the tests that expect hardcoded "author@example.com" would break, and that makes the step 1/3 and the remainder of this patch good changes.

In any case, I think all of 1/3 and 2/3 taken together are good preparatory steps for 3/3.

Thanks, will queue.
Previous: Prarit BhargavaNext: Prarit Bhargava
Message 5 of 7 in “Implement option to output local-part of email addresses”
  1. 0/3 Implement option to output local-part of email addressesPrarit Bhargava, Oct 24, 2019
  2. 3/3 pretty: add "%aL"|"%al|%cL|%cl" option to output local-part of email addressesPrarit Bhargava, Oct 24, 2019
  3. Junio C HamanoOct 25, 2019
  4. 2/3 t4203: Use test-lib.sh definitionsPrarit Bhargava, Oct 24, 2019
  5. Junio C HamanoOct 25, 2019
  6. 1/3 t6006: Use test-lib.sh definitionsPrarit Bhargava, Oct 24, 2019
  7. Junio C HamanoOct 25, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.