aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-02-28 11:18:52 -0800
committerAlon Zakai <alonzakai@gmail.com>2014-02-28 11:19:06 -0800
commita5f8c63184234b2a6840d86f90e6a4630e73936d (patch)
tree1db1e28165c940f3ee010539c63ed0b53fa05463
parent311bce51cfcb6df841fcfb773058d9f3084e5f63 (diff)
add a test for fastcomp issue 24
-rw-r--r--tests/test_core.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/test_core.py b/tests/test_core.py
index 6d341192..e456f90d 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -4540,6 +4540,41 @@ 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_constglobalunion(self):
+ if self.emcc_args is None: return self.skip('needs emcc')
+ self.emcc_args += ['-s', 'EXPORT_ALL=1']
+
+ self.do_run(r'''
+#include <stdio.h>
+
+struct one_const {
+ long a;
+};
+
+struct two_consts {
+ long a;
+ long b;
+};
+
+union some_consts {
+ struct one_const one;
+ struct two_consts two;
+};
+
+union some_consts my_consts = {{
+ 1
+}};
+
+struct one_const addr_of_my_consts = {
+ (long)(&my_consts)
+};
+
+int main(void) {
+ printf("%li\n", !!addr_of_my_consts.a);
+ return 0;
+}
+ ''', '1')
+
### 'Medium' tests
def test_fannkuch(self):