harec

[hare] Hare compiler, written in C11 for POSIX OSs
Log | Files | Refs | README | LICENSE

commit d70b91ef8f36c60eb179d932cf520dd11d5b9a87
parent 205dcaa6299b4d4453c2fafff0630c6b3edde89f
Author: Ember Sawady <ecs@d2evs.net>
Date:   Tue, 31 Jan 2023 22:27:33 +0000

Replace 26-gen.ha with 26-regression.ha

In order to have somewhere to stick misc. regression tests

Signed-off-by: Ember Sawady <ecs@d2evs.net>

Diffstat:
Dtests/26-gen.ha | 72------------------------------------------------------------------------
Atests/26-regression.ha | 72++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mtests/configure | 2+-
3 files changed, 73 insertions(+), 73 deletions(-)

diff --git a/tests/26-gen.ha b/tests/26-gen.ha @@ -1,72 +0,0 @@ -// Tests for various gen bugs - -type embedded = struct { - a: u64, - b: u8, -}; - -type thing = struct { - offs: u64, - e: embedded, -}; - -def THING: thing = thing{ - offs = 0, - e = embedded { - a = 1, - b = 0, - }, -}; - -let global: int = 0; - -export fn main() void = { - let t = thing { - offs = 0, - e = embedded { - a = 1, - b = 0, - }, - }; - let t = t; - assert(t.e.a == 1); - - let t2 = THING; - assert(t2.e.a == 1); - - t2.offs = 42; - assert(THING.offs == 0); - - let x: (void | int) = 10; - match (x) { - case let i: int => - assert(i == 10); - case void => - abort(); - }; - - let p = 0; - let p = &p: uintptr: u64: (u64 | void); - let p = match (p) { - case void => - abort(); - case let p: u64 => - yield p: uintptr: *int; - }; - assert(*p == 0); - - let thing: int = 0; - let thing = &thing: (*int | int); - let p = match (thing) { - case int => - abort(); - case let p: *int => - yield p; - }; - *p = 0; - - switch (&global) { - case &global => void; - case => abort(); - }; -}; diff --git a/tests/26-regression.ha b/tests/26-regression.ha @@ -0,0 +1,72 @@ +// Miscellaneous regression tests + +type embedded = struct { + a: u64, + b: u8, +}; + +type thing = struct { + offs: u64, + e: embedded, +}; + +def THING: thing = thing{ + offs = 0, + e = embedded { + a = 1, + b = 0, + }, +}; + +let global: int = 0; + +export fn main() void = { + let t = thing { + offs = 0, + e = embedded { + a = 1, + b = 0, + }, + }; + let t = t; + assert(t.e.a == 1); + + let t2 = THING; + assert(t2.e.a == 1); + + t2.offs = 42; + assert(THING.offs == 0); + + let x: (void | int) = 10; + match (x) { + case let i: int => + assert(i == 10); + case void => + abort(); + }; + + let p = 0; + let p = &p: uintptr: u64: (u64 | void); + let p = match (p) { + case void => + abort(); + case let p: u64 => + yield p: uintptr: *int; + }; + assert(*p == 0); + + let thing: int = 0; + let thing = &thing: (*int | int); + let p = match (thing) { + case int => + abort(); + case let p: *int => + yield p; + }; + *p = 0; + + switch (&global) { + case &global => void; + case => abort(); + }; +}; diff --git a/tests/configure b/tests/configure @@ -42,7 +42,7 @@ tests() { 23-errors \ 24-imports \ 25-promotion \ - 26-gen \ + 26-regression \ 27-rt \ 28-insert \ 29-unarithm \