Browse Source

Test off by one bug in vfscanf

oddcoder 4 years ago
parent
commit
1b131b8c60

+ 1 - 0
tests/Makefile

@@ -44,6 +44,7 @@ EXPECT_NAMES=\
 	stdio/printf_space_pad \
 	stdio/ungetc_multiple \
 	stdio/ungetc_ftell \
+	stdio/fscanf_offby1 \
 	stdlib/a64l \
 	stdlib/alloc \
 	stdlib/atof \

+ 0 - 0
tests/expected/stdio/fscanf_offby1.stderr


+ 1 - 0
tests/expected/stdio/fscanf_offby1.stdout

@@ -0,0 +1 @@
+1234, 7, 32

+ 8 - 0
tests/stdio/fscanf_offby1.c

@@ -0,0 +1,8 @@
+//1234 a
+#include <stdio.h>
+int main() {
+        FILE *f = fopen("stdio/fscanf_offby1.c", "r");
+        int x;
+        fscanf(f, "//%d", &x);
+        printf("%d, %ld, %d\n", x, ftell(f), fgetc(f));
+}