log UPDATE store last message
diff --git a/tests/utests/basic/test_inout.c b/tests/utests/basic/test_inout.c
index be27510..3f83568 100644
--- a/tests/utests/basic/test_inout.c
+++ b/tests/utests/basic/test_inout.c
@@ -84,8 +84,11 @@
char *str1 = "a", *str2 = "b";
assert_int_equal(LY_EINVAL, ly_in_new_memory(NULL, NULL));
+ CHECK_LOG_LASTMSG("Invalid argument str (ly_in_new_memory()).");
assert_int_equal(LY_EINVAL, ly_in_new_memory(str1, NULL));
+ CHECK_LOG_LASTMSG("Invalid argument in (ly_in_new_memory()).");
assert_null(ly_in_memory(NULL, NULL));
+ CHECK_LOG_LASTMSG("Invalid argument in (ly_in_memory()).");
assert_int_equal(LY_SUCCESS, ly_in_new_memory(str1, &in));
assert_int_equal(LY_IN_MEMORY, ly_in_type(in));
@@ -103,12 +106,15 @@
struct stat statbuf;
assert_int_equal(LY_EINVAL, ly_in_new_fd(-1, NULL));
+ CHECK_LOG_LASTMSG("Invalid argument fd >= 0 (ly_in_new_fd()).");
assert_int_equal(-1, ly_in_fd(NULL, -1));
+ CHECK_LOG_LASTMSG("Invalid argument in (ly_in_fd()).");
assert_int_not_equal(-1, fd1 = open(TEST_INPUT_FILE, O_RDONLY));
assert_int_not_equal(-1, fd2 = open(TEST_INPUT_FILE, O_RDONLY));
assert_int_equal(LY_EINVAL, ly_in_new_fd(fd1, NULL));
+ CHECK_LOG_LASTMSG("Invalid argument in (ly_in_new_fd()).");
assert_int_equal(LY_SUCCESS, ly_in_new_fd(fd1, &in));
assert_int_equal(LY_IN_FD, ly_in_type(in));
diff --git a/tests/utests/utests.h b/tests/utests/utests.h
index 594d528..c2e7733 100644
--- a/tests/utests/utests.h
+++ b/tests/utests/utests.h
@@ -1224,6 +1224,14 @@
_UC->in = NULL
/**
+ * @brief Check expected last error message.
+ *
+ * @param[in] MSG Expected error message.
+ */
+#define CHECK_LOG_LASTMSG(MSG) \
+ CHECK_STRING(ly_last_errmsg(), MSG)
+
+/**
* @brief Check expected last error in libyang context, which is then cleared. Can be called repeatedly to check
* several errors. If NULL is provided as MSG, no error info record (NULL) is expected.
*