git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: Taylor Blau <me@ttaylorr.com>
Cc: git@vger.kernel.org, dstolee@microsoft.com
Subject: Re: [PATCH 1/2] t5318: use 'test_must_be_empty'
Date: Tue, 2 Jun 2020 20:04:03 +0200	[thread overview]
Message-ID: <20200602180403.GA4791@szeder.dev> (raw)
In-Reply-To: <fddbe588147444fe2675224c94f50e24a1d12871.1591034353.git.me@ttaylorr.com>

On Mon, Jun 01, 2020 at 12:01:27PM -0600, Taylor Blau wrote:
> A handful of tests in t5318 use 'test_line_count = 0 ...' to make sure
> that some command does not write any output. While correct, it is more
> helpful to use 'test_must_be_empty' instead, since the latter prints the
> contents of the file if it is non-empty.
> 
> Since 'test_line_count' only prints the expected and actual line count,
> not the contents, using 'test_must_be_empty' may be more helpful for
> debugging if there is regression in any of these tests.

These two paragraphs essentially say the same thing, so I think only
one would be sufficient, but...  Both paragraphs are wrong, because
'test_line_count' does include the content of the file on failure:

  expecting success of 9999.1 'test': 
          cat >foo <<-EOF &&
          Add
          some
          content
          EOF
          test_line_count = 0 foo
  
  test_line_count: line count for foo != 0
  Add
  some
  content
  not ok 1 - test

Having said that, I think that the change itself is good, because
'test_must_be_empty foo' is more idiomatic.


  reply	other threads:[~2020-06-02 18:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-01 18:01 [PATCH 0/2] t5318: test '--stdin-commits' with '--[no-]progress' Taylor Blau
2020-06-01 18:01 ` [PATCH 1/2] t5318: use 'test_must_be_empty' Taylor Blau
2020-06-02 18:04   ` SZEDER Gábor [this message]
2020-06-03 22:21     ` Taylor Blau
2020-06-01 18:01 ` [PATCH 2/2] t5318: test that '--stdin-commits' respects '--[no-]progress' Taylor Blau
2020-06-01 19:35 ` [PATCH 0/2] t5318: test '--stdin-commits' with '--[no-]progress' Derrick Stolee
2020-06-01 19:36   ` Taylor Blau

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=20200602180403.GA4791@szeder.dev \
    --to=szeder.dev@gmail.com \
    --cc=dstolee@microsoft.com \
    --cc=git@vger.kernel.org \
    --cc=me@ttaylorr.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).