// @test fixture: every test passes (exits without aborting). package data; type point = struct { x: i32, y: i32 }; @test fn check_add() void = { let a: i32 = 2; let b: i32 = 3; let c: i32 = a + b; if (c != 5) { let _: i32 = 1 / 0; // abort via div-by-zero would also work }; }; @test fn check_match() void = { let r: (i32 | str) = 7; let v: i32 = match (r) { case let n: i32 => yield n; case let s: str => yield 0; }; if (v != 7) { let _: i32 = 1 / 0; }; }; // #227: compound assign (`-=`/`+=`) on a local field must // load-combine-store, not drop the op. Pre-fix wwstage stored the bare // rhs (p.x->4, p.y->5, view.len->1), so each mismatch aborts via 1/0. @test fn check_local_field_compound() void = { let p: point = point { x = 10i32, y = 3i32 }; p.x -= 4i32; p.y += 5i32; if (p.x != 6) { let _: i32 = 1 / 0; }; if (p.y != 8) { let _: i32 = 1 / 0; }; let view: str = "hello"; view.len -= 1; let n: i32 = view.len: i32; if (n != 4) { let _: i32 = 1 / 0; }; };