aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/test_function_pointers.sh
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-09-28 15:24:28 +0900
committernsfisis <nsfisis@gmail.com>2025-09-28 15:24:28 +0900
commit1b208f7f0a3b7d6b72c2a431d9fcd6e18fe76f5d (patch)
tree4902e2907f39cb0ae05439365e70d5628396a6fc /tests/test_function_pointers.sh
parent235969b792bf11e8b7927318cf01b5ef5705177b (diff)
downloadducc-1b208f7f0a3b7d6b72c2a431d9fcd6e18fe76f5d.tar.gz
ducc-1b208f7f0a3b7d6b72c2a431d9fcd6e18fe76f5d.tar.zst
ducc-1b208f7f0a3b7d6b72c2a431d9fcd6e18fe76f5d.zip
feat: support using function as a value
Diffstat (limited to 'tests/test_function_pointers.sh')
-rw-r--r--tests/test_function_pointers.sh18
1 files changed, 15 insertions, 3 deletions
diff --git a/tests/test_function_pointers.sh b/tests/test_function_pointers.sh
index c97a087..cddc623 100644
--- a/tests/test_function_pointers.sh
+++ b/tests/test_function_pointers.sh
@@ -1,12 +1,24 @@
cat <<'EOF' > expected
+a
+h
+g
EOF
test_diff <<'EOF'
-int* f(int a);
-int (*f)(int a);
+int* f1(int a);
+int (*f2)(int a);
extern int atexit (void (*) (void));
extern int atexit (void (*fn) (void));
-int main() {}
+int printf(const char*, ...);
+
+void g() { printf("g\n"); }
+void h() { printf("h\n"); }
+
+int main() {
+ atexit(g);
+ atexit(h);
+ printf("a\n");
+}
EOF