diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-12-20 19:53:06 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-12-20 19:53:06 -0800 |
commit | 78fde14808c0b075bd040d23b1d8cfb349c7cd84 (patch) | |
tree | 31b47e7c8b597a156314c755751c09debcbc1c99 /tests | |
parent | 62d5c159873ad08a4f3ec35074b2cdc7a3c46455 (diff) |
fix feof, plus test
Diffstat (limited to 'tests')
-rw-r--r-- | tests/files.cpp | 12 | ||||
-rw-r--r-- | tests/runner.py | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/tests/files.cpp b/tests/files.cpp index d692ce67..e1a38421 100644 --- a/tests/files.cpp +++ b/tests/files.cpp @@ -28,6 +28,18 @@ int main() fclose (file); free (buffer); + // Do it again, with a loop on feof + + printf("loop: "); + file = fopen("somefile.binary", "rb"); + assert(file); + while (!feof(file)) { + char c = fgetc(file); + if (c != EOF) printf("%d ", c); + } + fclose (file); + printf("\n"); + // Standard streams printf("input:%s\n", gets((char*)malloc(1024))); diff --git a/tests/runner.py b/tests/runner.py index a2073af1..e9886ab8 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -2932,7 +2932,7 @@ at function.:blag other.close() src = open(path_from_root('tests', 'files.cpp'), 'r').read() - self.do_run(src, 'size: 7\ndata: 100,-56,50,25,10,77,123\ninput:hi there!\ntexto\ntexte\n$\n5 : 10,30,20,11,88\nother=some data.\nseeked=me da.\nseeked=ata.\nseeked=ta.\nfscanfed: 10 - hello\n', + self.do_run(src, 'size: 7\ndata: 100,-56,50,25,10,77,123\nloop: 100 -56 50 25 10 77 123 \ninput:hi there!\ntexto\ntexte\n$\n5 : 10,30,20,11,88\nother=some data.\nseeked=me da.\nseeked=ata.\nseeked=ta.\nfscanfed: 10 - hello\n', post_build=post, extra_emscripten_args=['-H', 'libc/fcntl.h']) def test_folders(self): |