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

Re: [PATCH v3 2/3] t1503: use test_must_be_empty

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 15, 2014, 22:33 UTC
Message-ID
<xmqqfvfs4ip7.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1410808059-1459-2-git-send-email-davvid@gmail.com>
David Aguilar <davvid@gmail.com> writes:
Show 7 quoted lines
> Use `test_must_be_be_empty <file>` instead of `test -z "$(cat <file>)"`.
>
> Suggested-by: Fabian Ruch <bafain@gmail.com>
> Signed-off-by: David Aguilar <davvid@gmail.com>
> ---
> Unchanged since last time, but rebased for the change in the
> previous patch.

It probably makes more sense to have this at the beginning of a series as preliminary clean-up. That way, the more interesting change does not have to have "test -z $(cat ...)" that makes readers go "Huh?".

Show 38 quoted lines
>
>  t/t1503-rev-parse-verify.sh | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/t/t1503-rev-parse-verify.sh b/t/t1503-rev-parse-verify.sh
> index fd9d0c3..4fe9f0e 100755
> --- a/t/t1503-rev-parse-verify.sh
> +++ b/t/t1503-rev-parse-verify.sh
> @@ -72,15 +72,15 @@ test_expect_success 'fails with any bad rev or many good revs' '
>  
>  test_expect_success 'fails silently when using -q' '
>  	test_must_fail git rev-parse --verify --quiet 2>error &&
> -	test -z "$(cat error)" &&
> +	test_must_be_empty error &&
>  	test_must_fail git rev-parse -q --verify foo 2>error &&
> -	test -z "$(cat error)" &&
> +	test_must_be_empty error &&
>  	test_must_fail git rev-parse --verify -q HEAD bar 2>error &&
> -	test -z "$(cat error)" &&
> +	test_must_be_empty error &&
>  	test_must_fail git rev-parse --quiet --verify baz HEAD 2>error &&
> -	test -z "$(cat error)" &&
> +	test_must_be_empty error &&
>  	test_must_fail git rev-parse -q --verify $HASH2 HEAD 2>error &&
> -	test -z "$(cat error)"
> +	test_must_be_empty error
>  '
>  
>  test_expect_success 'fails silently when using -q with deleted reflogs' '
> @@ -89,7 +89,7 @@ test_expect_success 'fails silently when using -q with deleted reflogs' '
>  	git update-ref -m "reflog message for refs/test" refs/test "$ref" &&
>  	git reflog delete --updateref --rewrite refs/test@{0} &&
>  	test_must_fail git rev-parse -q --verify refs/test@{0} >error 2>&1 &&
> -	test -z "$(cat error)"
> +	test_must_be_empty error
>  '
>  
>  test_expect_success 'no stdout output on error' '
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 7 in “t1503: test rev-parse --verify --quiet with deleted reflogs”
  1. 1/3 t1503: test rev-parse --verify --quiet with deleted reflogsDavid Aguilar, Sep 15, 2014
  2. 2/3 t1503: use test_must_be_emptyDavid Aguilar, Sep 15, 2014
  3. 3/3 Documentation: a note about stdout for git rev-parse --verify --quietDavid Aguilar, Sep 15, 2014
  4. Junio C HamanoSep 15, 2014
  5. Junio C HamanoSep 15, 2014
  6. Junio C HamanoSep 15, 2014
  7. David AguilarSep 16, 2014

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.