aboutsummaryrefslogtreecommitdiff
path: root/tests/runner.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-01-06 17:07:03 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-01-06 17:07:03 -0800
commit5557409855d6c4a744f69e43891e7bd8902808d6 (patch)
tree673e74a34675f80d8bf66317f590d9abc653bbdb /tests/runner.py
parent23ee96ab9b7dcb9a0e2bbfdf36594a846c64b48f (diff)
parent355082514bc071c0b94fc83a351f3907b2a428ab (diff)
Merge pull request #164 from FishingCactus/static_variable
Fix handling of static variable inside function
Diffstat (limited to 'tests/runner.py')
-rw-r--r--tests/runner.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py
index 07d55650..58e82c6b 100644
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -3804,6 +3804,35 @@ def process(filename):
return 1;
}
''', 'hello world', includes=[path_from_root('tests', 'libcxx', 'include')]);
+
+ def test_static_variable(self):
+ src = '''
+ #include <stdio.h>
+
+ struct DATA
+ {
+ int value;
+
+ DATA()
+ {
+ value = 0;
+ }
+ };
+
+ DATA & GetData()
+ {
+ static DATA data;
+
+ return data;
+ }
+
+ int main()
+ {
+ GetData().value = 10;
+ printf( "value:%i", GetData().value );
+ }
+ '''
+ self.do_run(src, 'value:10')
def test_cubescript(self):
if self.emcc_args is not None and '-O2' in self.emcc_args: