From: Brendan Hansen Date: Fri, 30 Jun 2023 01:26:47 +0000 (-0500) Subject: added test case and updated CHANGELOG X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=c9002701b37b094b3cf247738823dde4a9299998;p=onyx.git added test case and updated CHANGELOG --- diff --git a/CHANGELOG b/CHANGELOG index 77975d02..03643ece 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,10 +8,13 @@ Additions: - Infrastructure to have custom sub-commands. - Any `*.wasm` file in `$ONYX_PATH/tools` is available to run with `onyx ` - `__futex_wait` and `__futex_wake` to platform layer. - - This allows for non-busy-waiting on mutexes on semaphores. + - This allows for non-busy-waiting on mutexes and semaphores. - Currently implemented for Onyx and JS platforms; WASI is impossible, but WASIX will come soon. - `--skip-native` flag to `onyx pkg sync` to skip compiling native libraries. - Ability to tag methods on structures. +- `tty_get` and `tty_set` functions in `core.os` + - Allows for controlling raw and echoed input + - Currently only for `onyx` runtime and on Linux only. Removals: diff --git a/tests/operators_as_methods b/tests/operators_as_methods new file mode 100644 index 00000000..6824d740 --- /dev/null +++ b/tests/operators_as_methods @@ -0,0 +1,2 @@ +If works! +Working! diff --git a/tests/operators_as_methods.onyx b/tests/operators_as_methods.onyx new file mode 100644 index 00000000..ff985815 --- /dev/null +++ b/tests/operators_as_methods.onyx @@ -0,0 +1,25 @@ +use core {*} +use runtime + +#inject runtime.vars.Onyx_Enable_Operator_Methods :: true + +main :: () { + Point :: struct { + x, y: i32; + + __eq :: (p1, p2: Point) => { + return p1.x == p2.x && p1.y == p2.y; + } + } + + p := Point.{1, 2}; + + if p == Point.{1, 2} { + println("If works!"); + } + + switch p { + case .{0, 0} --- + case .{1, 2} do println("Working!"); + } +}