diff options
| author | schu <schu-github@schulog.org> | 2011-08-03 01:17:31 +0200 |
|---|---|---|
| committer | schu <schu-github@schulog.org> | 2011-08-03 01:17:31 +0200 |
| commit | 5274c31a89ec9075cc74ff189f6264a976c04571 (patch) | |
| tree | c1836657c586acb2e01a33df9f56ca2777367d72 /tests/t04-commit.c | |
| parent | 03d88ed415a09faf161d8a081c18f51826be584a (diff) | |
| download | libgit2-5274c31a89ec9075cc74ff189f6264a976c04571.tar.gz | |
signature.c: fix off-by-one error
Signed-off-by: schu <schu-github@schulog.org>
Diffstat (limited to 'tests/t04-commit.c')
| -rw-r--r-- | tests/t04-commit.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/t04-commit.c b/tests/t04-commit.c index 53f0faefb..3b327ec9d 100644 --- a/tests/t04-commit.c +++ b/tests/t04-commit.c @@ -478,6 +478,31 @@ BEGIN_TEST(signature1, "can not create a signature with empty name or email") must_fail(try_build_signature("nulltoken", " ", 1234567890, 60)); END_TEST +BEGIN_TEST(signature2, "creating a one character signature") + git_signature *sign; + sign = git_signature_new("x", "foo@bar.baz", 1234567890, 60); + must_be_true(sign != NULL); + must_pass(strcmp(sign->name, "x")); + must_pass(strcmp(sign->email, "foo@bar.baz")); + git_signature_free((git_signature *)sign); +END_TEST + +BEGIN_TEST(signature3, "creating a two character signature") + git_signature *sign; + sign = git_signature_new("xx", "x@y.z", 1234567890, 60); + must_be_true(sign != NULL); + must_pass(strcmp(sign->name, "x")); + must_pass(strcmp(sign->email, "foo@bar.baz")); + git_signature_free((git_signature *)sign); +END_TEST + +BEGIN_TEST(signature4, "creating a zero character signature") + git_signature *sign; + sign = git_signature_new("", "x@y.z", 1234567890, 60); + must_be_true(sign == NULL); +END_TEST + + /* External declaration for testing the buffer parsing method */ int commit_parse_buffer(git_commit *commit, void *data, size_t len, unsigned int parse_flags); @@ -758,4 +783,7 @@ BEGIN_SUITE(commit) ADD_TEST(signature0); ADD_TEST(signature1); + ADD_TEST(signature2); + ADD_TEST(signature3); + ADD_TEST(signature4); END_SUITE |
