diff options
Diffstat (limited to 'test/run_tests.cpp')
| -rw-r--r-- | test/run_tests.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp index 5f7a9ec8e0..e7b3e57c66 100644 --- a/test/run_tests.cpp +++ b/test/run_tests.cpp @@ -1235,6 +1235,27 @@ pub fn main(args: [][]u8) %void => { } } )SOURCE", "OK\n"); + + add_simple_case("return struct byval from function", R"SOURCE( +import "std.zig"; +struct Foo { + x: i32, + y: i32, +} +fn make_foo() Foo => { + Foo { + .x = 1234, + .y = 5678, + } +} +pub fn main(args: [][]u8) %void => { + const foo = make_foo(); + if (foo.y != 5678) { + print_str("BAD\n"); + } + print_str("OK\n"); +} + )SOURCE", "OK\n"); } |
