[PATCH v2 03/10] mktree tests: add test for invalid object type
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Apr 20, 2021, 12:50 UTC
- Message-ID
- <patch-03.10-cd585017a9-20210420T124428Z-avarab@gmail.com>
- In-Reply-To
- <cover-00.10-0000000000-20210420T124428Z-avarab@gmail.com>
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 --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 '
-- 2.31.1.723.ga5d7868e4a