aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-07-02 19:00:58 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-07-03 15:31:05 -0700
commit26576167eb0794d54dfb2e3d305edaacde635bd4 (patch)
treedecabaf93cb46d59d5045ed4a877a70c00bbafb3
parentc3965c1799c7682dcba8c477c13e8a9705d5b95f (diff)
add function pointers test
-rwxr-xr-xtests/runner.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py
index 68d3246c..ab1e3e9f 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -10672,6 +10672,21 @@ f.close()
void sidey() { printf("hello from side\n"); }
''', 'hello from main\nhello from side\n')
+ # function pointers
+ test('fp1', 'typedef void (*voidfunc)();', r'''
+ #include <stdio.h>
+ #include "header.h"
+ voidfunc sidey(voidfunc f);
+ void a() { printf("hello from funcptr\n"); }
+ int main() {
+ sidey(a)();
+ return 0;
+ }
+ ''', '''
+ #include "header.h"
+ voidfunc sidey(voidfunc f) { return f; }
+ ''', 'hello from funcptr\n')
+
# Global initializer
test('global init', '', r'''
#include <stdio.h>