error = file->write(file, buf, len);
if (error < GIT_SUCCESS)
return git__rethrow(error, "Failed to write to buffer");
+ return GIT_SUCCESS;
}
}
}
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);
ADD_TEST(filebuf0);
ADD_TEST(filebuf1);
+ ADD_TEST(filebuf2);
END_SUITE