From: Junio C Hamano <gitster@pobox.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Joey S <jgsal@protonmail.com>,
"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [OUTREACHY][PATCH v2] t7006: Use test_path_is_* functions in test script
Date: Mon, 26 Oct 2020 14:24:52 -0700 [thread overview]
Message-ID: <xmqqwnzcd6jf.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <20201026205028.GC2645313@google.com> (Jonathan Nieder's message of "Mon, 26 Oct 2020 13:50:28 -0700")
Jonathan Nieder <jrnieder@gmail.com> writes:
> Overall (as someone who's worked a bit with this test script before),
> looks good to me. Thanks for your work.
>
>> - ${if_local_config}test -e core.pager_used
>> + ${if_local_config}test_path_is_file core.pager_used
>
> This bit is a little subtle: ${if_local_config} is either '' or '! ',
> and in the latter case the benefit of test_path_is_file printing a
> message if and only if the result is false goes away.
>
> Would the following, squashed in, make sense?
Thanks for a great suggestion. The if_local_config thing was
inherited and not a problem introduced by Joey, but it is a good
idea to clean it up at the same time, I think.
> Thanks,
> Jonathan
>
> diff --git i/t/t7006-pager.sh w/t/t7006-pager.sh
> index fdb450e446a..11327944741 100755
> --- i/t/t7006-pager.sh
> +++ w/t/t7006-pager.sh
> @@ -411,13 +411,13 @@ test_PAGER_overrides() {
> }
>
> test_core_pager_overrides() {
> - if_local_config=
> + pager_wanted=true
> used_if_wanted='overrides PAGER'
> test_core_pager "$@"
> }
>
> test_local_config_ignored() {
> - if_local_config='! '
> + pager_wanted=
> used_if_wanted='is not used'
> test_core_pager "$@"
> }
> @@ -432,18 +432,23 @@ test_core_pager() {
> export PAGER &&
> test_config core.pager 'wc >core.pager_used' &&
> $full_command &&
> - ${if_local_config}test_path_is_file core.pager_used
> + if test -n '$pager_wanted'
> + then
> + test_path_is_file core.pager_used
> + else
> + test_path_is_missing core.pager_used
> + fi
> "
> }
>
> test_core_pager_subdir() {
> - if_local_config=
> + pager_wanted=true
> used_if_wanted='overrides PAGER'
> test_pager_subdir_helper "$@"
> }
>
> test_no_local_config_subdir() {
> - if_local_config='! '
> + pager_wanted=
> used_if_wanted='is not used'
> test_pager_subdir_helper "$@"
> }
> @@ -464,7 +469,12 @@ test_pager_subdir_helper() {
> cd sub &&
> $full_command
> ) &&
> - ${if_local_config}test_path_is_file core.pager_used
> + if test -n '$pager_wanted'
> + then
> + test_path_is_file core.pager_used
> + else
> + test_path_is_missing core.pager_used
> + fi
> "
> }
>
next prev parent reply other threads:[~2020-10-26 21:25 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-20 19:53 [OUTREACHY][PATCH v2] t7006: Use test_path_is_* functions in test script Joey S
2020-10-21 13:25 ` Phillip Wood
2020-10-21 18:42 ` Junio C Hamano
2020-10-21 21:42 ` Joey Salazar
2020-10-21 21:57 ` Junio C Hamano
2020-10-21 22:21 ` Joey Salazar
2020-10-26 20:50 ` Jonathan Nieder
2020-10-26 21:24 ` Junio C Hamano [this message]
2020-10-26 21:46 ` Joey Salazar
2020-10-26 22:02 ` Jonathan Nieder
2020-10-26 23:00 ` Joey Salazar
2020-10-27 0:04 ` Joey Salazar
2020-10-27 0:14 ` Jonathan Nieder
2020-10-27 23:45 ` Joey Salazar
2020-10-28 0:19 ` Jonathan Nieder
2020-10-28 2:45 ` Joey Salazar
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqwnzcd6jf.fsf@gitster.c.googlers.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=jgsal@protonmail.com \
--cc=jrnieder@gmail.com \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).