mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-21 14:39:10 +00:00
Add test case checking GIT_FILEBUF_APPEND
Signed-off-by: schu <schu-github@schulog.org>
This commit is contained in:
parent
37172582ec
commit
24bd5e556b
@ -675,6 +675,23 @@ BEGIN_TEST(filebuf0, "make sure git_filebuf_open doesn't delete an existing lock
|
|||||||
must_pass(gitfo_unlink(testlock));
|
must_pass(gitfo_unlink(testlock));
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
BEGIN_TEST(filebuf1, "make sure GIT_FILEBUF_APPEND works as expected")
|
||||||
|
git_filebuf file;
|
||||||
|
int fd;
|
||||||
|
char test[] = "test";
|
||||||
|
|
||||||
|
fd = gitfo_creat(test, 0644);
|
||||||
|
must_pass(fd);
|
||||||
|
must_pass(gitfo_write(fd, "libgit2 rocks\n", 14));
|
||||||
|
must_pass(gitfo_close(fd));
|
||||||
|
|
||||||
|
must_pass(git_filebuf_open(&file, test, GIT_FILEBUF_APPEND));
|
||||||
|
must_pass(git_filebuf_printf(&file, "%s\n", "libgit2 rocks"));
|
||||||
|
must_pass(git_filebuf_commit(&file));
|
||||||
|
|
||||||
|
must_pass(gitfo_unlink(test));
|
||||||
|
END_TEST
|
||||||
|
|
||||||
BEGIN_SUITE(core)
|
BEGIN_SUITE(core)
|
||||||
ADD_TEST(string0);
|
ADD_TEST(string0);
|
||||||
ADD_TEST(string1);
|
ADD_TEST(string1);
|
||||||
@ -698,4 +715,5 @@ BEGIN_SUITE(core)
|
|||||||
ADD_TEST(dirent4);
|
ADD_TEST(dirent4);
|
||||||
|
|
||||||
ADD_TEST(filebuf0);
|
ADD_TEST(filebuf0);
|
||||||
|
ADD_TEST(filebuf1);
|
||||||
END_SUITE
|
END_SUITE
|
||||||
|
Loading…
Reference in New Issue
Block a user