diff options
author | Jukka Jylänki <jujjyl@gmail.com> | 2014-06-07 15:33:38 +0300 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2014-06-10 22:47:40 +0300 |
commit | 21043de9613fc4d1fa948c344a0dc93b88e6cb15 (patch) | |
tree | 32176524b5b6b1b2c76b15d9e3a3822659987c78 /tests/test_core.py | |
parent | 40aeae811088d43905f2a9d12cdcced5dd07b2ad (diff) |
We don't seem to have tests for --js-library in core suite, so move other.test_js_libraries to the core test suite so that it gets tested in all modes.
Diffstat (limited to 'tests/test_core.py')
-rw-r--r-- | tests/test_core.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/test_core.py b/tests/test_core.py index b9057f4e..76a87066 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -4643,6 +4643,39 @@ PORT: 3979 ''' self.do_run(src, 'value\narray_item1\narray_item2\narray_item3\n3\n3.00\n2.20\nJansson: Node with ID `0` not found. Context has `10` nodes.\n0\nJansson: No JSON context.\njansson!') + def test_js_libraries(self): + if self.emcc_args == None: return self.skip('needs emcc') + + open(os.path.join(self.get_dir(), 'main.cpp'), 'w').write(''' + #include <stdio.h> + extern "C" { + extern void printey(); + extern int calcey(int x, int y); + } + int main() { + printey(); + printf("*%d*\\n", calcey(10, 22)); + return 0; + } + ''') + open(os.path.join(self.get_dir(), 'mylib1.js'), 'w').write(''' + mergeInto(LibraryManager.library, { + printey: function() { + Module.print('hello from lib!'); + } + }); + ''') + open(os.path.join(self.get_dir(), 'mylib2.js'), 'w').write(''' + mergeInto(LibraryManager.library, { + calcey: function(x, y) { + return x + y; + } + }); + ''') + + self.emcc_args += ['--js-library', os.path.join(self.get_dir(), 'mylib1.js'), '--js-library', os.path.join(self.get_dir(), 'mylib2.js')] + self.do_run(open(os.path.join(self.get_dir(), 'main.cpp'), 'r').read(), 'hello from lib!\n*32*\n') + def test_constglobalunion(self): if self.emcc_args is None: return self.skip('needs emcc') self.emcc_args += ['-s', 'EXPORT_ALL=1'] |