aboutgitcodelistschat:MatrixIRC
path: root/tests/unit/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/util.c')
-rw-r--r--tests/unit/util.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/unit/util.c b/tests/unit/util.c
index 45171f2..5c36c54 100644
--- a/tests/unit/util.c
+++ b/tests/unit/util.c
@@ -30,6 +30,8 @@ int pipefd[2];
pid_t pid;
char path[PATH_MAX] = "/tmp/test-seitan";
struct gluten gluten;
+char stderr_buff[BUFSIZ];
+char stdout_buff[BUFSIZ];
int install_notification_filter(struct args_target *at)
{
@@ -231,3 +233,19 @@ void teardown()
munmap(at, sizeof(struct args_target));
unlink(path);
}
+
+void ck_stderr()
+{
+ setbuf(stderr, stderr_buff);
+}
+
+void ck_stdout()
+{
+ setbuf(stdout, stdout_buff);
+}
+
+void ck_error_msg(char *s)
+{
+ ck_assert_msg(strstr(stderr_buff, s) != NULL, "err=\"%s\" doesn't contain \"%s\" ",
+ stderr_buff, s);
+}