diff mbox series

[v2,03/10] mktree tests: add test for invalid object type

Message ID patch-03.10-cd585017a9-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
Add a missing test for an invalid object type to the mktree tests,
making it consistent with the same tests in cat-file.c. This tests the
interaction of mktree_line() and type_from_string().

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

Patch

diff --git a/t/t1010-mktree.sh b/t/t1010-mktree.sh
index b946f87686..2a7b04aed8 100755
--- a/t/t1010-mktree.sh
+++ b/t/t1010-mktree.sh
@@ -58,6 +58,16 @@  test_expect_success 'allow missing object with --missing' '
 	test_cmp tree.missing actual
 '
 
+test_expect_success 'invalid object type' '
+	sed "s/tree/whee/g" <top >bad-type &&
+	test_must_fail git mktree <bad-type >out 2>err &&
+	test_must_be_empty out &&
+	cat >expected <<-\EOF &&
+	fatal: invalid object type "whee"
+	EOF
+	test_cmp expected err
+'
+
 test_expect_success 'mktree refuses to read ls-tree -r output (1)' '
 	test_must_fail git mktree <all >actual
 '