diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-01-24 18:34:50 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-01-24 18:34:50 -0700 |
| commit | 419652ee8ff709deae988603ecca2c335599d969 (patch) | |
| tree | 7678349497a842e64073df781fe241d3dae9c84d /test/run_tests.cpp | |
| parent | ca7b85b32e26acfd716c02047966254a34cd2237 (diff) | |
| download | zig-419652ee8ff709deae988603ecca2c335599d969.tar.gz zig-419652ee8ff709deae988603ecca2c335599d969.zip | |
ability to return structs byvalue from functions
closes #57
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"); } |
