mirror of
https://git.proxmox.com/git/libgit2
synced 2025-08-07 19:03:19 +00:00
t04-commit: add tests for git_signature__parse
git_signature__parse used to be very strict about what's a well-formed signature. Add tests checking git_signature__parse can stick with "unexpected" signatures (IOW no author name and / or no email, etc). Signed-off-by: schu <schu-github@schulog.org>
This commit is contained in:
parent
8b2c913acb
commit
60caf02465
@ -241,6 +241,78 @@ BEGIN_TEST(parse1, "parse the signature line in a commit")
|
|||||||
123456,
|
123456,
|
||||||
-60);
|
-60);
|
||||||
|
|
||||||
|
/* Parse a signature without an author field */
|
||||||
|
TEST_SIGNATURE_PASS(
|
||||||
|
"committer <tanoku@gmail.com> 123456 -0100 \n",
|
||||||
|
"committer ",
|
||||||
|
"",
|
||||||
|
"tanoku@gmail.com",
|
||||||
|
123456,
|
||||||
|
-60);
|
||||||
|
|
||||||
|
/* Parse a signature without an author field */
|
||||||
|
TEST_SIGNATURE_PASS(
|
||||||
|
"committer <tanoku@gmail.com> 123456 -0100 \n",
|
||||||
|
"committer ",
|
||||||
|
"",
|
||||||
|
"tanoku@gmail.com",
|
||||||
|
123456,
|
||||||
|
-60);
|
||||||
|
|
||||||
|
/* Parse a signature with an empty author field */
|
||||||
|
TEST_SIGNATURE_PASS(
|
||||||
|
"committer <tanoku@gmail.com> 123456 -0100 \n",
|
||||||
|
"committer ",
|
||||||
|
" ",
|
||||||
|
"tanoku@gmail.com",
|
||||||
|
123456,
|
||||||
|
-60);
|
||||||
|
|
||||||
|
/* Parse a signature with an empty email field */
|
||||||
|
TEST_SIGNATURE_PASS(
|
||||||
|
"committer Vicent Marti <> 123456 -0100 \n",
|
||||||
|
"committer ",
|
||||||
|
"Vicent Marti",
|
||||||
|
"",
|
||||||
|
123456,
|
||||||
|
-60);
|
||||||
|
|
||||||
|
/* Parse a signature with an empty email field */
|
||||||
|
TEST_SIGNATURE_PASS(
|
||||||
|
"committer Vicent Marti < > 123456 -0100 \n",
|
||||||
|
"committer ",
|
||||||
|
"Vicent Marti",
|
||||||
|
" ",
|
||||||
|
123456,
|
||||||
|
-60);
|
||||||
|
|
||||||
|
/* Parse a signature with empty name and email */
|
||||||
|
TEST_SIGNATURE_PASS(
|
||||||
|
"committer <> 123456 -0100 \n",
|
||||||
|
"committer ",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
123456,
|
||||||
|
-60);
|
||||||
|
|
||||||
|
/* Parse a signature with empty name and email */
|
||||||
|
TEST_SIGNATURE_PASS(
|
||||||
|
"committer < > 123456 -0100 \n",
|
||||||
|
"committer ",
|
||||||
|
"",
|
||||||
|
" ",
|
||||||
|
123456,
|
||||||
|
-60);
|
||||||
|
|
||||||
|
/* Parse an obviously invalid signature */
|
||||||
|
TEST_SIGNATURE_PASS(
|
||||||
|
"committer foo<@bar> 123456 -0100 \n",
|
||||||
|
"committer ",
|
||||||
|
"fo",
|
||||||
|
"@bar",
|
||||||
|
123456,
|
||||||
|
-60);
|
||||||
|
|
||||||
TEST_SIGNATURE_FAIL(
|
TEST_SIGNATURE_FAIL(
|
||||||
"committer Vicent Marti <tanoku@gmail.com> 123456 -1500 \n",
|
"committer Vicent Marti <tanoku@gmail.com> 123456 -1500 \n",
|
||||||
"committer ");
|
"committer ");
|
||||||
|
Loading…
Reference in New Issue
Block a user