Re: [OUTREACHY][PATCH v2] t7006: Use test_path_is_* functions in test script
- From
- Joey Salazar <jgsal@protonmail.com>
- Date
- Oct 26, 2020, 21:46 UTC
- Message-ID
- <Bgt8H4Cev0hu-OKtYHazhsRRIFO_6bAoBqdc4tep09T98tL426R9WXIAMjm7aO4b0uPrZGldPhZ1mV3f9pbS3PDN4bOlb9JkUvvXKtnUFHA=@protonmail.com>
- In-Reply-To
- <xmqqwnzcd6jf.fsf@gitster.c.googlers.com>
Thank you both for the comments and update, squashing both commits make sense to me as well, yet I can incorporate the changes in a new patch (v3) if that would be preferred.
Thanks, Joey
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Monday, October 26, 2020 3:24 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 129 quoted lines
> 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
> >
> >
> > "
> > }
> >