Skip to content

Commit 3ab9e8c

Browse files
committed
Add and enable tests
1 parent 39d692c commit 3ab9e8c

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

integration_tests/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,8 @@ RUN(NAME global_syms_04 LABELS cpython llvm c wasm wasm_x64)
694694
RUN(NAME global_syms_05 LABELS cpython llvm c)
695695
RUN(NAME global_syms_06 LABELS cpython llvm c)
696696

697-
RUN(NAME callback_01 LABELS cpython llvm)
697+
RUN(NAME callback_01 LABELS cpython llvm c)
698+
RUN(NAME callback_02 LABELS cpython llvm c)
698699

699700
# Intrinsic Functions
700701
RUN(NAME intrinsics_01 LABELS cpython llvm NOFAST) # any

integration_tests/callback_02.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from lpython import ccallback, i32, Callable
2+
3+
# test issue 2169
4+
5+
def foo(x : i32) -> i32:
6+
return x**2
7+
8+
def bar(func : Callable[[i32], i32], arg : i32) -> i32:
9+
return func(arg)
10+
11+
@ccallback
12+
def entry_point() -> None:
13+
z: i32 = 5
14+
x: i32 = bar(foo, z)
15+
assert z**2 == x
16+
17+
18+
entry_point()

0 commit comments

Comments
 (0)