git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Andrei Rybak <rybak.a.v@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Michael J Gruber" <git@grubix.eu>, "Jeff King" <peff@peff.net>,
	"Patrick Steinhardt" <ps@pks.im>,
	"Michael Haggerty" <mhagger@alum.mit.edu>
Subject: [PATCH v3 1/7] t1005: assert output of ls-files
Date: Fri, 24 Mar 2023 21:54:28 +0100	[thread overview]
Message-ID: <20230324205434.93754-2-rybak.a.v@gmail.com> (raw)
In-Reply-To: <20230324205434.93754-1-rybak.a.v@gmail.com>

Test 'reset should work' in t1005-read-tree-reset.sh compares two files
"expect" and "actual" to assert the expected output of "git ls-files".
Several other tests in the same file also create files "expect" and
"actual", but don't use them in assertions.

Assert output of "git ls-files" in t1005-read-tree-reset.sh to improve
test coverage.

Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
---
 t/t1005-read-tree-reset.sh | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/t/t1005-read-tree-reset.sh b/t/t1005-read-tree-reset.sh
index 12e30d77d0..26be4a2b5a 100755
--- a/t/t1005-read-tree-reset.sh
+++ b/t/t1005-read-tree-reset.sh
@@ -41,7 +41,8 @@ test_expect_success 'reset should remove remnants from a failed merge' '
 	git ls-files -s &&
 	read_tree_u_must_succeed --reset -u HEAD &&
 	git ls-files -s >actual &&
-	! test -f old
+	! test -f old &&
+	test_cmp expect actual
 '
 
 test_expect_success 'two-way reset should remove remnants too' '
@@ -56,7 +57,8 @@ test_expect_success 'two-way reset should remove remnants too' '
 	git ls-files -s &&
 	read_tree_u_must_succeed --reset -u HEAD HEAD &&
 	git ls-files -s >actual &&
-	! test -f old
+	! test -f old &&
+	test_cmp expect actual
 '
 
 test_expect_success 'Porcelain reset should remove remnants too' '
@@ -71,7 +73,8 @@ test_expect_success 'Porcelain reset should remove remnants too' '
 	git ls-files -s &&
 	git reset --hard &&
 	git ls-files -s >actual &&
-	! test -f old
+	! test -f old &&
+	test_cmp expect actual
 '
 
 test_expect_success 'Porcelain checkout -f should remove remnants too' '
@@ -86,7 +89,8 @@ test_expect_success 'Porcelain checkout -f should remove remnants too' '
 	git ls-files -s &&
 	git checkout -f &&
 	git ls-files -s >actual &&
-	! test -f old
+	! test -f old &&
+	test_cmp expect actual
 '
 
 test_expect_success 'Porcelain checkout -f HEAD should remove remnants too' '
@@ -101,7 +105,8 @@ test_expect_success 'Porcelain checkout -f HEAD should remove remnants too' '
 	git ls-files -s &&
 	git checkout -f HEAD &&
 	git ls-files -s >actual &&
-	! test -f old
+	! test -f old &&
+	test_cmp expect actual
 '
 
 test_done
-- 
2.40.0


  reply	other threads:[~2023-03-24 20:54 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-12 20:15 [PATCH v1 0/7] t: fix unused files, part 1 Andrei Rybak
2023-03-12 20:15 ` [PATCH v1 1/7] t1005: assert output of ls-files Andrei Rybak
2023-03-14  8:51   ` Michael J Gruber
2023-03-18 15:17     ` Andrei Rybak
2023-03-12 20:15 ` [PATCH v1 1/1] t1507: assert output of rev-parse Andrei Rybak
2023-03-12 20:24   ` Andrei Rybak
2023-03-12 20:15 ` [PATCH v1 2/7] t1006: assert error output of cat-file Andrei Rybak
2023-03-12 20:15 ` [PATCH v1 3/7] t1010: assert empty output of mktree Andrei Rybak
2023-03-13 21:38   ` Junio C Hamano
2023-03-12 20:15 ` [PATCH v1 4/7] t1302: don't create unused file Andrei Rybak
2023-03-12 20:15 ` [PATCH v1 5/7] t1400: assert output of update-ref Andrei Rybak
2023-03-12 20:15 ` [PATCH v1 6/7] t1404: don't create unused file Andrei Rybak
2023-03-13 21:56   ` Junio C Hamano
2023-03-12 20:15 ` [PATCH v1 7/7] t1507: assert output of rev-parse Andrei Rybak
2023-03-13 22:41 ` [PATCH v1 0/7] t: fix unused files, part 1 Junio C Hamano
2023-03-14 20:43   ` Andrei Rybak
2023-03-18 15:46 ` [PATCH v2 " Andrei Rybak
2023-03-18 15:46 ` [PATCH v2 1/7] t1005: assert output of ls-files Andrei Rybak
2023-03-18 15:46 ` [PATCH v2 2/7] t1006: assert error output of cat-file Andrei Rybak
2023-03-18 15:46 ` [PATCH v2 3/7] t1010: don't create unused files Andrei Rybak
2023-03-18 15:46 ` [PATCH v2 4/7] t1302: don't create unused file Andrei Rybak
2023-03-18 15:46 ` [PATCH v2 5/7] t1400: assert output of update-ref Andrei Rybak
2023-03-18 15:46 ` [PATCH v2 6/7] t1404: don't create unused file Andrei Rybak
2023-03-18 15:46 ` [PATCH v2 7/7] t1507: assert output of rev-parse Andrei Rybak
2023-03-24 20:54 ` [PATCH v3 0/7] t: fix unused files, part 1 Andrei Rybak
2023-03-24 20:54   ` Andrei Rybak [this message]
2023-03-24 20:54   ` [PATCH v3 2/7] t1006: assert error output of cat-file Andrei Rybak
2023-03-24 20:54   ` [PATCH v3 3/7] t1010: don't create unused files Andrei Rybak
2023-03-24 20:54   ` [PATCH v3 4/7] t1302: don't create unused file Andrei Rybak
2023-03-24 20:54   ` [PATCH v3 5/7] t1400: assert output of update-ref Andrei Rybak
2023-03-24 20:54   ` [PATCH v3 6/7] t1404: don't create unused file Andrei Rybak
2023-03-24 20:54   ` [PATCH v3 7/7] t1507: assert output of rev-parse Andrei Rybak
2023-03-28 17:37   ` [PATCH v3 0/7] t: fix unused files, part 1 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

  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=20230324205434.93754-2-rybak.a.v@gmail.com \
    --to=rybak.a.v@gmail.com \
    --cc=avarab@gmail.com \
    --cc=git@grubix.eu \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mhagger@alum.mit.edu \
    --cc=peff@peff.net \
    --cc=ps@pks.im \
    /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).