diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-03-18 21:52:37 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-03-18 21:52:37 -0700 |
commit | 8754ddc7e358b04aefbb453f3d07fd597474a1bf (patch) | |
tree | e2f9a1eb08cda1acd2c7ce09cdb427d4919d4b7b /tests | |
parent | 10f6f6303cc8bf691ccebd75410b953a0e9dde12 (diff) | |
parent | ec8e3e0ade3fd5554a5303834d308891a3fca5d2 (diff) |
Merge pull request #945 from ting-yuan/incoming
Fix the return value of fgets().
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/runner.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py index 1a030eae..529dcc48 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -5795,6 +5795,30 @@ def process(filename): self.emcc_args += ['--embed-file', 'file_with_byte_234.txt'] self.do_run(src, '*234\n') + def test_fgets_eol(self): + if self.emcc_args is None: return self.skip('requires emcc') + src = r''' + #include <stdio.h> + char buf[32]; + int main() + { + char *r = "SUCCESS"; + FILE *f = fopen("eol.txt", "r"); + while (fgets(buf, 32, f) != NULL) { + if (buf[0] == '\0') { + r = "FAIL"; + break; + } + } + printf("%s\n", r); + fclose(f); + return 0; + } + ''' + open('eol.txt', 'wb').write('\n') + self.emcc_args += ['--embed-file', 'eol.txt'] + self.do_run(src, 'SUCCESS\n') + def test_folders(self): add_pre_run = ''' def process(filename): |