diff options
Diffstat (limited to 'test/run_tests.cpp')
| -rw-r--r-- | test/run_tests.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp index b15f6e2ec4..84704d5f64 100644 --- a/test/run_tests.cpp +++ b/test/run_tests.cpp @@ -1409,6 +1409,22 @@ pub fn main(args: [][]u8) -> %void { %%stdout.printf("OK\n"); } )SOURCE", "OK\n"); + + add_simple_case("call member function directly", R"SOURCE( +import "std.zig"; +struct Foo { + x: i32, + fn member(foo: Foo) -> i32 { foo.x } +} +pub fn main(args: [][]u8) -> %void { + const instance = Foo { .x = 1234, }; + const result = Foo.member(instance); + if (result != 1234) { + %%stdout.printf("BAD\n"); + } + %%stdout.printf("OK\n"); +} + )SOURCE", "OK\n"); } |
