diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-02-26 21:30:20 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-02-26 21:30:20 -0800 |
commit | 71cccfcf7980c134fee5aa019883b3da0e76cccf (patch) | |
tree | 26d1418c1bb8af7792fe75d18d09710efc9369d5 /tests | |
parent | c207c8c67ca2f13437d589f22dc5d136ea7ac3f6 (diff) |
--pre-js and --post-js options
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/runner.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py index 5d7345fd..3b295ed2 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -6199,6 +6199,25 @@ f.close() self.assertContained('*hello from lib\n|hello from lib|\n*', run_js(os.path.join(self.get_dir(), 'a.out.js'))) + def test_emcc_js_link(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(), 'before.js'), 'w').write(''' + var MESSAGE = 'hello from js'; + if (typeof Module != 'undefined') throw 'This code should run before anything else!'; + ''') + open(os.path.join(self.get_dir(), 'after.js'), 'w').write(''' + print(MESSAGE); + ''') + + Popen([EMCC, os.path.join(self.get_dir(), 'main.cpp'), '--pre-js', 'before.js', '--post-js', 'after.js']).communicate() + self.assertContained('hello from main\nhello from js\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() |