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