summaryrefslogtreecommitdiff
path: root/tests/t00-core.c
diff options
context:
space:
mode:
authorKirill A. Shutemov <kirill@shutemov.name>2011-06-30 00:16:23 +0300
committerKirill A. Shutemov <kirill@shutemov.name>2011-06-30 16:19:19 +0300
commitfe5babacd6a2a8f358603404ee27327c20830c03 (patch)
treeb5187a679096a8d37467aa86264f755bf76f1694 /tests/t00-core.c
parent2dfc08875abfab747338c659f85bdf98d718cd1c (diff)
downloadlibgit2-fe5babacd6a2a8f358603404ee27327c20830c03.tar.gz
filebuf: fix endless loop on writing buf > WRITE_BUFFER_SIZE
Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Diffstat (limited to 'tests/t00-core.c')
-rw-r--r--tests/t00-core.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/t00-core.c b/tests/t00-core.c
index aa000857..31ed8c38 100644
--- a/tests/t00-core.c
+++ b/tests/t00-core.c
@@ -692,6 +692,19 @@ BEGIN_TEST(filebuf1, "make sure GIT_FILEBUF_APPEND works as expected")
must_pass(gitfo_unlink(test));
END_TEST
+BEGIN_TEST(filebuf2, "make sure git_filebuf_write writes large buffer correctly")
+ git_filebuf file;
+ char test[] = "test";
+ unsigned char buf[4096 * 4]; /* 2 * WRITE_BUFFER_SIZE */
+
+ memset(buf, 0xfe, sizeof(buf));
+ must_pass(git_filebuf_open(&file, test, 0));
+ must_pass(git_filebuf_write(&file, buf, sizeof(buf)));
+ must_pass(git_filebuf_commit(&file));
+
+ must_pass(gitfo_unlink(test));
+END_TEST
+
BEGIN_SUITE(core)
ADD_TEST(string0);
ADD_TEST(string1);
@@ -716,4 +729,5 @@ BEGIN_SUITE(core)
ADD_TEST(filebuf0);
ADD_TEST(filebuf1);
+ ADD_TEST(filebuf2);
END_SUITE