From: Brendan Hansen Date: Thu, 6 Jul 2023 04:23:03 +0000 (-0500) Subject: added: old test case X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=7b2661f8b5f32e8467faf13af326dacbcc9a233c;p=onyx.git added: old test case --- diff --git a/tests/ignored_return_values b/tests/ignored_return_values new file mode 100644 index 00000000..20cae175 --- /dev/null +++ b/tests/ignored_return_values @@ -0,0 +1,5 @@ +hello +123 +Str: hello +12 +13 diff --git a/tests/ignored_return_values.onyx b/tests/ignored_return_values.onyx new file mode 100644 index 00000000..d27f529a --- /dev/null +++ b/tests/ignored_return_values.onyx @@ -0,0 +1,35 @@ +use core + +foo :: () -> (str, i32, bool, Allocator) { + return "hello", 123, false, .{}; +} + +takes_str :: (s: str) { + core.printf("Str: {}\n", s); +} + +Foo :: struct { + x, y: i32; + m: str; +} + +#inject Foo { + method :: (f: ^Foo) -> (i32, i32, str) { + return f.x, f.y, f.m; + } +} + +main :: () { + m, n := foo(); + core.println(m); + core.println(n); + + takes_str(foo()); + + f := Foo.{ 12, 34, "Working!" }; + x := f->method(); + core.println(x); + + y := 1; + core.println(y + Foo.method(^f)); +}