diff mbox series

[v1,1/1] t1507: assert output of rev-parse

Message ID 20230312201520.370234-3-rybak.a.v@gmail.com (mailing list archive)
State Accepted
Commit a93cbe8d78a42bb016f62b755421bdd4fd7d5d14
Headers show
Series [v1,1/1] t1507: assert output of rev-parse | expand

Commit Message

Andrei Rybak March 12, 2023, 8:15 p.m. UTC
Tests in t1507-rev-parse-upstream.sh compare files "expect" and "actual"
to assert the output of "git rev-parse", "git show", and "git log".
However, two of the tests '@{reflog}-parsing does not look beyond colon'
and '@{upstream}-parsing does not look beyond colon' don't inspect the
contents of the created files.

Assert output of "git rev-parse" in tests in t1507-rev-parse-upstream.sh
to improve test coverage.

Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
---
 t/t1507-rev-parse-upstream.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Andrei Rybak March 12, 2023, 8:24 p.m. UTC | #1
I've sent this patch twice by accident.  Please ignore this version.

The correct version has subject "[PATCH v1 7/7] t1507: assert output of rev-parse".
https://lore.kernel.org/git/20230312201520.370234-9-rybak.a.v@gmail.com/
diff mbox series

Patch

diff --git a/t/t1507-rev-parse-upstream.sh b/t/t1507-rev-parse-upstream.sh
index c34714ffe3..4458820168 100755
--- a/t/t1507-rev-parse-upstream.sh
+++ b/t/t1507-rev-parse-upstream.sh
@@ -258,7 +258,8 @@  test_expect_success '@{reflog}-parsing does not look beyond colon' '
 	git add @{yesterday} &&
 	git commit -m "funny reflog file" &&
 	git hash-object @{yesterday} >expect &&
-	git rev-parse HEAD:@{yesterday} >actual
+	git rev-parse HEAD:@{yesterday} >actual &&
+	test_cmp expect actual
 '
 
 test_expect_success '@{upstream}-parsing does not look beyond colon' '
@@ -266,7 +267,8 @@  test_expect_success '@{upstream}-parsing does not look beyond colon' '
 	git add @{upstream} &&
 	git commit -m "funny upstream file" &&
 	git hash-object @{upstream} >expect &&
-	git rev-parse HEAD:@{upstream} >actual
+	git rev-parse HEAD:@{upstream} >actual &&
+	test_cmp expect actual
 '
 
 test_done