diff options
Diffstat (limited to 'tests/runner.py')
-rwxr-xr-x | tests/runner.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py index 47e18ed7..976772ce 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -9332,6 +9332,26 @@ def process(filename): ''' self.do_run(src, 'abs(-10): 10\nabs(-11): 11'); + def test_embind_2(self): + if self.emcc_args is None: return self.skip('requires emcc') + Building.COMPILER_TEST_OPTS += ['--bind', '--post-js', 'post.js'] + open('post.js', 'w').write(''' + Module.print('lerp ' + Module.lerp(1, 2, 0.66) + '.'); + ''') + src = r''' + #include <stdio.h> + #include <SDL/SDL.h> + #include <emscripten/bind.h> + using namespace emscripten; + float lerp(float a, float b, float t) { + return (1 - t) * a + t * b; + } + EMSCRIPTEN_BINDINGS(my_module) { + function("lerp", &lerp); + } + ''' + self.do_run(src, 'lerp 1.66'); + def test_scriptaclass(self): if self.emcc_args is None: return self.skip('requires emcc') |