diff --git a/tests/Makefile b/tests/Makefile index bc6123d6766d50542d026d2cd67a36da199fb598..c6958733d23372df3750eb2b241a906b4cdc557f 100644 --- a/tests/Makefile +++ b/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 \ diff --git a/tests/expected/stdio/fscanf_offby1.stderr b/tests/expected/stdio/fscanf_offby1.stderr new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tests/expected/stdio/fscanf_offby1.stdout b/tests/expected/stdio/fscanf_offby1.stdout new file mode 100644 index 0000000000000000000000000000000000000000..daf724a9e5c2d676a8b87bef70c650515449e4e0 --- /dev/null +++ b/tests/expected/stdio/fscanf_offby1.stdout @@ -0,0 +1 @@ +1234, 7, 32 diff --git a/tests/stdio/fscanf_offby1.c b/tests/stdio/fscanf_offby1.c new file mode 100644 index 0000000000000000000000000000000000000000..c8339357933e27b929ef88778f6d2643a0daee4f --- /dev/null +++ b/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)); +}