commit 89cb94fd268a2a9d2c736a10057744c1269c4d85
parent b209595d375107f1af47087645dad7e98673f2cb
Author: Drew DeVault <sir@cmpwn.com>
Date: Sat, 24 Jul 2021 14:47:26 +0200
gen: expand call tests
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat:
1 file changed, 12 insertions(+), 0 deletions(-)
diff --git a/tests/903-call.ha b/tests/903-call.ha
@@ -1,4 +1,8 @@
+type coords = struct { x: int, y: int };
+
fn foo() size = 2;
+fn equal(x: int, y: int) bool = x == y;
+fn aggregate(c: coords) int = c.x;
export fn main() int = {
// Indirect
@@ -8,5 +12,13 @@ export fn main() int = {
// Direct
let x = [1, 2, 3];
assert(x[foo()] == 3);
+
+ // Direct & indirect params
+ let x = 1234;
+ assert(equal(x, 1234));
+
+ // Aggregate params
+ let x = coords { x = 1234, y = 4321 };
+ assert(aggregate(x) == 1234);
return 0;
};