aboutsummaryrefslogtreecommitdiff
path: root/tests/runner.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-06-17 13:24:22 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-06-17 13:24:22 -0700
commit81404885333898b87da39c074b33ed70f327ea63 (patch)
tree2912e1da6c230410dc14dfe8e0b6d1adb5b73b6d /tests/runner.py
parent8f371ae5c3aeebb018e2e0c60f4c2f27e2b36837 (diff)
allow multiple pre-js and post-js
Diffstat (limited to 'tests/runner.py')
-rwxr-xr-xtests/runner.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py
index 5714511e..f8dfc97e 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -7028,6 +7028,25 @@ f.close()
open(os.path.join(self.get_dir(), 'a.out.js'), 'w').write(src)
assert 'hello from main' in run_js(os.path.join(self.get_dir(), 'a.out.js')), 'main should print when called manually'
+ def test_prepost2(self):
+ open(os.path.join(self.get_dir(), 'main.cpp'), 'w').write('''
+ #include <stdio.h>
+ int main() {
+ printf("hello from main\\n");
+ return 0;
+ }
+ ''')
+ open(os.path.join(self.get_dir(), 'pre.js'), 'w').write('''
+ var Module = {
+ preRun: function() { Module.print('pre-run') },
+ };
+ ''')
+ open(os.path.join(self.get_dir(), 'pre2.js'), 'w').write('''
+ Module.postRun = function() { Module.print('post-run') };
+ ''')
+ Popen(['python', EMCC, os.path.join(self.get_dir(), 'main.cpp'), '--pre-js', 'pre.js', '--pre-js', 'pre2.js']).communicate()
+ self.assertContained('pre-run\nhello from main\npost-run\n', run_js(os.path.join(self.get_dir(), 'a.out.js')))
+
def test_eliminator(self):
input = open(path_from_root('tools', 'eliminator', 'eliminator-test.js')).read()
expected = open(path_from_root('tools', 'eliminator', 'eliminator-test-output.js')).read()