git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Andrei Rybak <rybak.a.v@gmail.com>
Cc: git@vger.kernel.org,
	"Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
	"Øystein Walle" <oystwa@gmail.com>,
	"Junio C Hamano" <gitster@pobox.com>
Subject: Re: [PATCH v2 3/6] t1300: don't create unused files
Date: Thu, 06 Apr 2023 10:38:00 +0200	[thread overview]
Message-ID: <230406.86pm8htnfk.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <20230403223338.468025-4-rybak.a.v@gmail.com>


On Tue, Apr 04 2023, Andrei Rybak wrote:

> Three tests in t1300-config.sh check that "git config --get" barfs when
> syntax errors are present in the config file.  The tests redirect
> standard output and standard error of "git config --get" to files,
> "actual" and "error" correspondingly.  They assert presence of an error
> message in file "error".  However, these tests don't use file "actual"
> for assertions.
>
> Don't redirect standard output of "git config --get" to file "actual" in
> t1300-config.sh to avoid creating unnecessary files.
>
> Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
> ---
>  t/t1300-config.sh | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/t/t1300-config.sh b/t/t1300-config.sh
> index d566729d74..8ac4531c1b 100755
> --- a/t/t1300-config.sh
> +++ b/t/t1300-config.sh
> @@ -1575,7 +1575,7 @@ test_expect_success 'barf on syntax error' '
>  	[section]
>  	key garbage
>  	EOF
> -	test_must_fail git config --get section.key >actual 2>error &&
> +	test_must_fail git config --get section.key 2>error &&
>  	test_i18ngrep " line 3 " error
>  '
>  
> @@ -1585,7 +1585,7 @@ test_expect_success 'barf on incomplete section header' '
>  	[section
>  	key = value
>  	EOF
> -	test_must_fail git config --get section.key >actual 2>error &&
> +	test_must_fail git config --get section.key 2>error &&
>  	test_i18ngrep " line 2 " error
>  '
>  
> @@ -1595,7 +1595,7 @@ test_expect_success 'barf on incomplete string' '
>  	[section]
>  	key = "value string
>  	EOF
> -	test_must_fail git config --get section.key >actual 2>error &&
> +	test_must_fail git config --get section.key 2>error &&
>  	test_i18ngrep " line 3 " error
>  '

Ditto my comment on 1/6, shouldn't we instead be doing e.g.:
	
	diff --git a/t/t1300-config.sh b/t/t1300-config.sh
	index 2575279ab84..df2070c2f09 100755
	--- a/t/t1300-config.sh
	+++ b/t/t1300-config.sh
	@@ -1575,7 +1575,8 @@ test_expect_success 'barf on syntax error' '
	 	[section]
	 	key garbage
	 	EOF
	-	test_must_fail git config --get section.key >actual 2>error &&
	+	test_must_fail git config --get section.key >out 2>error &&
	+	test_must_be_empty out &&
	 	test_i18ngrep " line 3 " error
	 '
	 
I.e. before this we had no coverage on the error being the only output,
but seemingly by mistake. Let's just assert that, rather than dropping
the redirection entirely, no?

  reply	other threads:[~2023-04-06  8:39 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-01 21:28 [PATCH v1 0/6] t: fix unused files, part 2 Andrei Rybak
2023-04-01 21:28 ` [PATCH v1 1/6] t0300: don't create unused file Andrei Rybak
2023-04-02  1:30   ` Eric Sunshine
2023-04-01 21:28 ` [PATCH v1 2/6] t1300: fix config file syntax error descriptions Andrei Rybak
2023-04-01 21:28 ` [PATCH v1 3/6] t1300: don't create unused files Andrei Rybak
2023-04-01 21:28 ` [PATCH v1 4/6] t1450: " Andrei Rybak
2023-04-01 21:28 ` [PATCH v1 5/6] t1502: " Andrei Rybak
2023-04-01 21:28 ` [PATCH v1 6/6] t2019: " Andrei Rybak
2023-04-03 22:33 ` [PATCH v2 0/6] t: fix unused files, part 2 Andrei Rybak
2023-04-03 22:33   ` [PATCH v2 1/6] t0300: don't create unused file Andrei Rybak
2023-04-06  8:34     ` Ævar Arnfjörð Bjarmason
2023-04-06 21:01       ` Andrei Rybak
2023-04-03 22:33   ` [PATCH v2 2/6] t1300: fix config file syntax error descriptions Andrei Rybak
2023-04-03 22:33   ` [PATCH v2 3/6] t1300: don't create unused files Andrei Rybak
2023-04-06  8:38     ` Ævar Arnfjörð Bjarmason [this message]
2023-04-06 21:30       ` Andrei Rybak
2023-04-06 21:35         ` git config tests for "'git config ignores pairs ..." (was Re: [PATCH v2 3/6] t1300: don't create unused files) Andrei Rybak
2023-04-14  8:13           ` [PATCH v1 0/2] git config tests for "'git config ignores pairs ..." Andrei Rybak
2023-04-14  8:13             ` [PATCH v1 1/2] t1300: drop duplicate test Andrei Rybak
2023-04-14  8:13             ` [PATCH v1 2/2] t1300: check stderr for "ignores pairs" tests Andrei Rybak
2023-04-14 13:28               ` Andrei Rybak
2023-04-18 17:50             ` [PATCH v2 0/3] git config tests for "'git config ignores pairs ..." Andrei Rybak
2023-04-18 17:50               ` [PATCH v2 1/3] t1300: drop duplicate test Andrei Rybak
2023-04-18 18:37                 ` Junio C Hamano
2023-04-18 17:50               ` [PATCH v2 2/3] t1300: check stderr for "ignores pairs" tests Andrei Rybak
2023-04-18 18:39                 ` Junio C Hamano
2023-04-18 17:50               ` [RFC PATCH v2 3/3] t1300: add tests for missing keys Andrei Rybak
2023-04-18 19:31                 ` Junio C Hamano
2023-04-18 17:53               ` [PATCH v2 0/3] git config tests for "'git config ignores pairs ..." Andrei Rybak
2023-04-23 13:46               ` [PATCH v3 " Andrei Rybak
2023-04-23 13:46                 ` [PATCH v3 1/3] t1300: drop duplicate test Andrei Rybak
2023-04-23 13:46                 ` [PATCH v3 2/3] t1300: check stderr for "ignores pairs" tests Andrei Rybak
2023-04-23 13:46                 ` [PATCH v3 3/3] t1300: add tests for missing keys Andrei Rybak
2023-05-01 22:02                 ` [PATCH v3 0/3] git config tests for "'git config ignores pairs ..." Junio C Hamano
2023-05-02 19:58                   ` Andrei Rybak
2023-04-03 22:33   ` [PATCH v2 4/6] t1450: don't create unused files Andrei Rybak
2023-04-06  8:41     ` Ævar Arnfjörð Bjarmason
2023-04-06 22:19       ` Andrei Rybak
2023-04-03 22:33   ` [PATCH v2 5/6] t1502: " Andrei Rybak
2023-04-06  8:15     ` Øystein Walle
2023-04-06  8:47     ` Ævar Arnfjörð Bjarmason
2023-04-06 19:51       ` Andrei Rybak
2023-04-03 22:33   ` [PATCH v2 6/6] t2019: " Andrei Rybak
2023-04-06  8:44     ` Ævar Arnfjörð Bjarmason
2023-04-07  2:19       ` Andrei Rybak
2023-04-08 20:54       ` [PATCH] t2024: fix loose/strict local base branch DWIM test Andrei Rybak
2023-04-10 17:37         ` Junio C Hamano
2023-04-17 19:10   ` [PATCH v3 0/6] t: fix unused files, part 2 Andrei Rybak
2023-04-17 19:10     ` [PATCH v3 1/6] t0300: don't create unused file Andrei Rybak
2023-04-17 19:10     ` [PATCH v3 2/6] t1300: fix config file syntax error descriptions Andrei Rybak
2023-04-17 19:10     ` [PATCH v3 3/6] t1300: don't create unused files Andrei Rybak
2023-04-17 19:10     ` [PATCH v3 4/6] t1450: " Andrei Rybak
2023-04-17 19:10     ` [PATCH v3 5/6] t1502: " Andrei Rybak
2023-04-17 19:10     ` [PATCH v3 6/6] t2019: " Andrei Rybak
2023-05-01 21:52     ` [PATCH v3 0/6] t: fix unused files, part 2 Junio C Hamano
2023-05-02 21:03       ` Andrei Rybak
2023-05-03  4:11       ` Elijah Newren
2023-05-03 15:54         ` Junio C Hamano

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=230406.86pm8htnfk.gmgdl@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=oystwa@gmail.com \
    --cc=rybak.a.v@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.
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).