diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-12-26 03:05:33 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-12-26 03:05:33 -0500 |
| commit | 6ed835ca67670098da79d4e329c6efcb12419599 (patch) | |
| tree | fad1400b90b2d0cf7f28dd90562c2b0311d1f33d /test/cases/eval.zig | |
| parent | 3ef6663b723e7391edbe84d3df48fcc79c66bc1f (diff) | |
| download | zig-6ed835ca67670098da79d4e329c6efcb12419599.tar.gz zig-6ed835ca67670098da79d4e329c6efcb12419599.zip | |
IR: port more tests
Diffstat (limited to 'test/cases/eval.zig')
| -rw-r--r-- | test/cases/eval.zig | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/cases/eval.zig b/test/cases/eval.zig index fb38760ea6..c34d552035 100644 --- a/test/cases/eval.zig +++ b/test/cases/eval.zig @@ -73,6 +73,27 @@ fn constExprEvalOnSingleExprBlocksFn(x: i32, b: bool) -> i32 { +fn staticallyInitalizedList() { + @setFnTest(this); + + assert(static_point_list[0].x == 1); + assert(static_point_list[0].y == 2); + assert(static_point_list[1].x == 3); + assert(static_point_list[1].y == 4); +} +const Point = struct { + x: i32, + y: i32, +}; +const static_point_list = []Point { makePoint(1, 2), makePoint(3, 4) }; +fn makePoint(x: i32, y: i32) -> Point { + return Point { + .x = x, + .y = y, + }; +} + + // TODO const assert = @import("std").debug.assert; fn assert(ok: bool) { |
