aboutsummaryrefslogtreecommitdiff
path: root/tests/runner.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-06-19 12:03:10 -0700
committerAlon Zakai <alonzakai@gmail.com>2011-06-19 12:03:10 -0700
commitf83a7e74298a283425248adf1dc8a0b9c07beaee (patch)
tree7c6dd1efcb18345522c537d14a58364f233b6826 /tests/runner.py
parent1eab898b003282bdd4b4839090ec9a6093c0e331 (diff)
support for customizing interactive input by setting Module.stdin
Diffstat (limited to 'tests/runner.py')
-rw-r--r--tests/runner.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/runner.py b/tests/runner.py
index 34595497..80503de6 100644
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -1769,7 +1769,10 @@ if 'benchmark' not in sys.argv:
def post(filename):
src = open(filename, 'r').read().replace(
'// {{PRE_RUN_ADDITIONS}}',
- '''STDIO.prepare('somefile.binary', [100, 200, 50, 25, 10, 77, 123]);''' # 200 becomes -56, since signed chars are used in memory
+ '''
+ STDIO.prepare('somefile.binary', [100, 200, 50, 25, 10, 77, 123]); // 200 becomes -56, since signed chars are used in memory
+ Module.stdin = function(prompt) { return 'hi there!' };
+ '''
)
open(filename, 'w').write(src)
@@ -1778,7 +1781,7 @@ if 'benchmark' not in sys.argv:
other.close()
src = open(path_from_root('tests', 'files.cpp'), 'r').read()
- self.do_test(src, 'size: 7\ndata: 100,-56,50,25,10,77,123\ntexto\ntexte\n5 : 10,30,20,11,88\nother=some data.\n', post_build=post)
+ self.do_test(src, 'size: 7\ndata: 100,-56,50,25,10,77,123\ninput:hi there!\ntexto\ntexte\n5 : 10,30,20,11,88\nother=some data.\n', post_build=post)
### 'Big' tests