aboutsummaryrefslogtreecommitdiff
path: root/tests/test_other.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-11-20 10:15:34 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-11-20 10:15:34 -0800
commit39549647380bc09d6ac05b880933daf7cf4c82c1 (patch)
tree6dcca414bebf8b85f77ca94f60ee08c1986c40bb /tests/test_other.py
parent814083f84a250a69ce66cf16ca38d0d7d425eee2 (diff)
test for static linking when using --js-library
Diffstat (limited to 'tests/test_other.py')
-rw-r--r--tests/test_other.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test_other.py b/tests/test_other.py
index 1144ec26..d1230c66 100644
--- a/tests/test_other.py
+++ b/tests/test_other.py
@@ -686,6 +686,38 @@ f.close()
}
''', ['hello through side\n'])
+ # js library call
+ open('lib.js', 'w').write(r'''
+ mergeInto(LibraryManager.library, {
+ test_lib_func: function(x) {
+ return x + 17.2;
+ }
+ });
+ ''')
+ test('js-lib', 'extern "C" { extern double test_lib_func(int input); }', r'''
+ #include <stdio.h>
+ #include "header.h"
+ extern double sidey();
+ int main2() { return 11; }
+ int main() {
+ int input = sidey();
+ double temp = test_lib_func(input);
+ printf("other says %.2f\n", temp);
+ printf("more: %.5f, %d\n", temp, input);
+ return 0;
+ }
+ ''', r'''
+ #include <stdio.h>
+ #include "header.h"
+ extern int main2();
+ double sidey() {
+ int temp = main2();
+ printf("main2 sed: %d\n", temp);
+ printf("main2 sed: %u, %c\n", temp, temp/2);
+ return test_lib_func(temp);
+ }
+ ''', 'other says 45.2', ['--js-library', 'lib.js'])
+
# libc usage in one modules. must force libc inclusion in the main module if that isn't the one using mallinfo()
try:
os.environ['EMCC_FORCE_STDLIBS'] = 'libc'