Add a real logic-test gate so future pure-sx game logic fails the build on a bad assertion: - tests/test.sx: `expect(cond, msg)` assert helper — prints a greppable `FAIL <file>:<line>: <msg>` and exits non-zero via process.exit on failure. - tools/run_tests.sh: snapshot runner mirroring sx/tests/run_examples.sh; runs each tests/<name>.sx and diffs stdout + exit code against tests/expected/. Exits 0 iff all tests pass. - tests/arith.sx (+ expected snapshots): seed passing sanity test. - README.md: document both halves of the gate — logic runner and the reproducible ios-sim build/launch sequence (with device discovery).
16 lines
573 B
Plaintext
16 lines
573 B
Plaintext
// m3te logic-test assert helper.
|
|
//
|
|
// `expect(cond, msg)` is a no-op when `cond` holds. On a false condition it
|
|
// prints a single greppable `FAIL <file>:<line>: <msg>` line to stdout and
|
|
// terminates the process NON-ZERO (exit 1) via process.exit, so a broken
|
|
// assertion fails `tools/run_tests.sh` and the build gate.
|
|
#import "modules/std.sx";
|
|
proc :: #import "modules/process.sx";
|
|
|
|
expect :: (cond: bool, msg: string, loc: Source_Location = #caller_location) {
|
|
if !cond {
|
|
print("FAIL {}:{}: {}\n", loc.file, loc.line, msg);
|
|
proc.exit(1);
|
|
}
|
|
}
|