added: old test case
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 6 Jul 2023 04:23:03 +0000 (23:23 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 6 Jul 2023 04:23:03 +0000 (23:23 -0500)
tests/ignored_return_values [new file with mode: 0644]
tests/ignored_return_values.onyx [new file with mode: 0644]

diff --git a/tests/ignored_return_values b/tests/ignored_return_values
new file mode 100644 (file)
index 0000000..20cae17
--- /dev/null
@@ -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 (file)
index 0000000..d27f529
--- /dev/null
@@ -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));
+}