aboutsummaryrefslogtreecommitdiff
path: root/tests/test_other.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-01-26 19:23:13 -0800
committerAlon Zakai <alonzakai@gmail.com>2014-01-26 19:25:17 -0800
commita5243b43651a44df897537f1ee4b45f4a7c6350e (patch)
treea591deeaada221d022e5893e874caf34e8c15317 /tests/test_other.py
parenta7c5795f3219450afe328d9da1445e661bd523db (diff)
support precompiled headers; fixes #2045
Diffstat (limited to 'tests/test_other.py')
-rw-r--r--tests/test_other.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_other.py b/tests/test_other.py
index 8895a911..74507c21 100644
--- a/tests/test_other.py
+++ b/tests/test_other.py
@@ -2324,3 +2324,22 @@ var Module = { print: function(x) { throw '<{(' + x + ')}>' } };
output = run_js(os.path.join(self.get_dir(), 'a.out.js'), stderr=PIPE, full_output=True, engine=NODE_JS)
assert r'<{(123456789)}>' in output, output
+ def test_precompiled_headers(self):
+ self.clear()
+
+ open('header.h', 'w').write('#define X 5\n')
+ Popen([PYTHON, EMCC, '-xc++-header', 'header.h', '-c']).communicate()
+ assert os.path.exists('header.h.gch')
+
+ open('src.cpp', 'w').write(r'''
+#include <stdio.h>
+int main() {
+ printf("|%d|\n", X);
+ return 0;
+}
+''')
+ Popen([PYTHON, EMCC, 'src.cpp', '-include', 'header.h']).communicate()
+
+ output = run_js(self.in_dir('a.out.js'), stderr=PIPE, full_output=True, engine=NODE_JS)
+ assert '|5|' in output, output
+