diff options
author | Patrick Steinhardt <ps@pks.im> | 2019-06-29 09:10:57 +0200 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2019-07-20 19:11:20 +0200 |
commit | 683ea2b095cd9be3b8b229894f083cd94e967988 (patch) | |
tree | a9033b0d2e56eed286250ce216bfe7e016ea29b2 | |
parent | a00842c40a808d193e72bbd7bab1d8030b564447 (diff) | |
download | libgit2-683ea2b095cd9be3b8b229894f083cd94e967988.tar.gz |
tests: core: add missing asserts for several function calls
Several function calls to `p_stat` and `p_close` have no verification if
they actually succeeded. As these functions _may_ fail and as we also
want to make sure that we're not doing anything dumb, let's check them,
too.
-rw-r--r-- | tests/core/posix.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/core/posix.c b/tests/core/posix.c index a459b26c6..795be31b8 100644 --- a/tests/core/posix.c +++ b/tests/core/posix.c @@ -122,7 +122,7 @@ void test_core_posix__utimes(void) cl_git_mkfile("foo", "Dummy file."); cl_must_pass(p_utimes("foo", times)); - p_stat("foo", &st); + cl_must_pass(p_stat("foo", &st)); cl_assert_equal_i(1234567890, st.st_atime); cl_assert_equal_i(1234567890, st.st_mtime); @@ -135,9 +135,9 @@ void test_core_posix__utimes(void) cl_must_pass(fd = p_open("foo", O_RDWR)); cl_must_pass(p_futimes(fd, times)); - p_close(fd); + cl_must_pass(p_close(fd)); - p_stat("foo", &st); + cl_must_pass(p_stat("foo", &st)); cl_assert_equal_i(1414141414, st.st_atime); cl_assert_equal_i(1414141414, st.st_mtime); @@ -148,11 +148,11 @@ void test_core_posix__utimes(void) cl_must_pass(p_utimes("foo", NULL)); curtime = time(NULL); - p_stat("foo", &st); + cl_must_pass(p_stat("foo", &st)); cl_assert((st.st_atime - curtime) < 5); cl_assert((st.st_mtime - curtime) < 5); - p_unlink("foo"); + cl_must_pass(p_unlink("foo")); } static void try_set_locale(int category) |