tests: unit: add parsing tests
This commit is contained in:
parent
ad57d063d3
commit
41550b1291
4 changed files with 175 additions and 0 deletions
15
tests/unit/common.c
Normal file
15
tests/unit/common.c
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#include <criterion/redirect.h>
|
||||
|
||||
void redirect_streams(void)
|
||||
{
|
||||
cr_redirect_stdin();
|
||||
cr_redirect_stdout();
|
||||
cr_redirect_stderr();
|
||||
}
|
||||
|
||||
void write_to_stdin(const char *input)
|
||||
{
|
||||
FILE *f = cr_get_redirected_stdin();
|
||||
fputs(input, f);
|
||||
fclose(f); // Make sure to send EOF when parsing
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue