diff options
Diffstat (limited to 'tests/commit/parse.c')
| -rw-r--r-- | tests/commit/parse.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/commit/parse.c b/tests/commit/parse.c index 3e1670ec4..838cfb467 100644 --- a/tests/commit/parse.c +++ b/tests/commit/parse.c @@ -513,6 +513,17 @@ a simple commit which works\n"; cl_assert_equal_s(gpgsig, signature.ptr); cl_assert_equal_s(data, signed_data.ptr); + /* Try to parse a tree */ + cl_git_pass(git_oid_fromstr(&commit_id, "45dd856fdd4d89b884c340ba0e047752d9b085d6")); + cl_git_fail_with(GIT_ENOTFOUND, git_commit_extract_signature(&signature, &signed_data, g_repo, &commit_id, NULL)); + cl_assert_equal_i(GITERR_INVALID, giterr_last()->klass); + + /* Try to parse an unsigned commit */ + cl_git_pass(git_odb_write(&commit_id, odb, passing_commit_cases[1], strlen(passing_commit_cases[1]), GIT_OBJ_COMMIT)); + cl_git_fail_with(GIT_ENOTFOUND, git_commit_extract_signature(&signature, &signed_data, g_repo, &commit_id, NULL)); + cl_assert_equal_i(GITERR_OBJECT, giterr_last()->klass); + git_buf_free(&signature); git_buf_free(&signed_data); + } |
