aboutsummaryrefslogtreecommitdiff
path: root/tests/test_other.py
diff options
context:
space:
mode:
authorAnthony Pesch <inolen@gmail.com>2013-08-27 23:43:56 -0700
committerAnthony Pesch <inolen@gmail.com>2013-08-29 12:57:33 -0700
commitfe3533636b24c23fb904f3ca94425003c0565177 (patch)
tree23ab00295c6a18f00c01690c50de9f53649d6e84 /tests/test_other.py
parent4d41dc3fa572f89249749c4b7a37864c99018004 (diff)
- added tests for tcgetattr / tcsetattr
- made test_stdin async to work in the node environment - clearerr should reset both eof and error indicators - fgetc was incorrectly setting the eof indicator. in cases where fread had errored with EAGAIN it was setting eof. I removed the set entirely, as there is no need for fgetc to even worry about it, fread will set the correct value in any case
Diffstat (limited to 'tests/test_other.py')
-rw-r--r--tests/test_other.py17
1 files changed, 3 insertions, 14 deletions
diff --git a/tests/test_other.py b/tests/test_other.py
index a6813b07..f583cf07 100644
--- a/tests/test_other.py
+++ b/tests/test_other.py
@@ -929,20 +929,9 @@ f.close()
self.assertContained('libf1\nlibf2\n', run_js(os.path.join(self.get_dir(), 'a.out.js')))
def test_stdin(self):
- open('main.cpp', 'w').write(r'''
-#include <stdio.h>
-int main(int argc, char const *argv[])
-{
- char str[10] = {0};
- scanf("%10s", str);
- printf("%s\n", str);
- return 0;
-}
-''')
- Building.emcc('main.cpp', output_filename='a.out.js')
- open('in.txt', 'w').write('abc')
- # node's stdin support is broken
- self.assertContained('abc', Popen(listify(SPIDERMONKEY_ENGINE) + ['a.out.js'], stdin=open('in.txt'), stdout=PIPE, stderr=PIPE).communicate()[0])
+ Building.emcc(path_from_root('tests', 'module', 'test_stdin.c'), output_filename='a.out.js')
+ open('in.txt', 'w').write('abcdef\nghijkl')
+ self.assertContained('abcdef\nghijkl\neof', run_js(os.path.join(self.get_dir(), 'a.out.js'), stdin=open('in.txt')))
def test_ungetc_fscanf(self):
open('main.cpp', 'w').write(r'''