mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2025-12-24 22:50:05 +01:00
test: add a few non-null checks to make the static analyzer happy
This commit is contained in:
parent
bf03c56300
commit
ec031bc4bf
3 changed files with 7 additions and 0 deletions
|
|
@ -703,6 +703,7 @@ MUNIT_TEST(test_iobuf_append_fd)
|
|||
MUNIT_TEST(test_iobuf_append_fd_too_many)
|
||||
{
|
||||
_cleanup_fclose_ FILE *fp = tmpfile();
|
||||
munit_assert_ptr_not_null(fp);
|
||||
int fd = fileno(fp);
|
||||
|
||||
_cleanup_iobuf_ struct iobuf *buf = iobuf_new(20);
|
||||
|
|
@ -732,6 +733,7 @@ MUNIT_TEST(test_iobuf_recv_fd)
|
|||
_cleanup_close_ int left = fds[0];
|
||||
_cleanup_close_ int right = fds[1];
|
||||
_cleanup_fclose_ FILE *fp = tmpfile();
|
||||
munit_assert_ptr_not_null(fp);
|
||||
|
||||
/* actual message data to be sent */
|
||||
char data[] = "some data\n";
|
||||
|
|
@ -782,7 +784,9 @@ MUNIT_TEST(test_pass_fd)
|
|||
/* Write some data to the file on it's real fd */
|
||||
for (size_t idx = 0; idx < ARRAY_LENGTH(fps); idx++) {
|
||||
_cleanup_free_ char *buf = xaprintf("foo %zu\n", idx);
|
||||
munit_assert_ptr_not_null(buf);
|
||||
FILE *fp = fps[idx];
|
||||
munit_assert_ptr_not_null(fp);
|
||||
fwrite(buf, strlen(buf) + 1, 1, fp);
|
||||
fflush(fp);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -239,6 +239,7 @@ source_enable_write(struct source *source, bool enable)
|
|||
MUNIT_TEST(test_sink)
|
||||
{
|
||||
struct sink *sink = sink_new();
|
||||
munit_assert_ptr_not_null(sink);
|
||||
sink_dispatch(sink);
|
||||
sink_dispatch(sink);
|
||||
|
||||
|
|
|
|||
|
|
@ -427,6 +427,7 @@ MUNIT_TEST(test_strstrip)
|
|||
while (t->string) {
|
||||
char *str;
|
||||
str = strstrip(t->string, t->what);
|
||||
munit_assert_ptr_not_null(str);
|
||||
munit_assert_string_equal(str, t->expected);
|
||||
free(str);
|
||||
t++;
|
||||
|
|
@ -521,6 +522,7 @@ MUNIT_TEST(test_cmdline_as_str)
|
|||
munit_assert_int(len, >=, 0);
|
||||
cmdline[len] = '\0';
|
||||
|
||||
munit_assert_ptr_not_null(from_function);
|
||||
munit_assert_string_equal(cmdline, from_function);
|
||||
|
||||
return MUNIT_OK;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue