diff mbox series

[v2,02/10] hash-object tests: more detailed test for invalid type

Message ID patch-02.10-0b48389325-20210420T124428Z-avarab@gmail.com (mailing list archive)
State New
Headers show
Series object.c et al: tests, small bug fixes etc. | expand

Commit Message

Ævar Arnfjörð Bjarmason April 20, 2021, 12:50 p.m. UTC
Change the tests added in b7994af0f92 (type_from_string_gently: make
sure length matches, 2015-04-17) to check the return code and error
that's emitted.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/t1007-hash-object.sh | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/t/t1007-hash-object.sh b/t/t1007-hash-object.sh
index 64b340f227..74486f6f1a 100755
--- a/t/t1007-hash-object.sh
+++ b/t/t1007-hash-object.sh
@@ -230,11 +230,19 @@  test_expect_success 'corrupt tag' '
 '
 
 test_expect_success 'hash-object complains about bogus type name' '
-	test_must_fail git hash-object -t bogus --stdin </dev/null
+	test_must_fail git hash-object -t bogus --stdin 2>actual </dev/null &&
+	cat >expect <<-\EOF &&
+	fatal: invalid object type "bogus"
+	EOF
+	test_cmp expect actual
 '
 
 test_expect_success 'hash-object complains about truncated type name' '
-	test_must_fail git hash-object -t bl --stdin </dev/null
+	test_must_fail git hash-object -t bl --stdin 2>actual </dev/null &&
+	cat >expect <<-\EOF &&
+	fatal: invalid object type "bl"
+	EOF
+	test_cmp expect actual
 '
 
 test_expect_success '--literally' '