Skip to content

Commit baf5336

Browse files
committed
Add test for returning structs from functions
1 parent a4ef3d2 commit baf5336

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

integration_tests/structs_11.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from ltypes import i32, f64, dataclass
2+
3+
@dataclass
4+
class A:
5+
x: i32
6+
y: f64
7+
8+
def f(x_: i32, y_: f64) -> A:
9+
a_struct: A = A(x_, y_)
10+
return a_struct
11+
12+
def test_struct_return():
13+
b: A = f(0, 1.0)
14+
print(b.x, b.y)
15+
assert b.x == 0
16+
assert b.y == 1.0
17+
18+
test_struct_return()

0 commit comments

Comments
 (0)