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.