Skip to content

Commit

Permalink
Add a test for fgets
Browse files Browse the repository at this point in the history
  • Loading branch information
jvoisin committed Jun 22, 2023
1 parent 44a71e3 commit 5827cef
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ CC=../x86_64-linux-musl-native/bin/gcc
GCOV=../x86_64-linux-musl-native/bin/gcov
CFLAGS=-I../include/ -D_FORTIFY_SOURCE=3 -static -O2

TARGETS=test_memcpy_static_write \
TARGETS= \
test_fgets \
test_memcpy_static_write \
test_memcpy_dynamic_write \
test_memcpy_static_read \
test_memcpy_dynamic_read \
Expand Down
15 changes: 15 additions & 0 deletions tests/test_fgets.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "common.h"

#define _GNU_SOURCE
#include <poll.h>

int main(int argc, char** argv) {
char buffer[12] = {0};

CHK_FAIL_START
fgets(buffer, 14, NULL);
CHK_FAIL_END

puts(buffer);
return ret;
}

0 comments on commit 5827cef

Please sign in to comment.