commit 2f405ec325e240ba84f9da532deac96ae709b572 parent ca311eebbda0e929da9daacc946b20770cb90489 Author: Ryan Sepassi <rsepassi@gmail.com> Date: Sat, 25 Apr 2026 16:30:39 -0700 scheme1: tighten 45-shell-spawn and 67-read-line to prelude-only Drop the chars->bv workaround and sys-exit calls in 45 (string literals and (exit) work now); add open-output/open-input error checks in 67 to match the 63/64/83 style. Diffstat:
| M | tests/scheme1/45-shell-spawn.scm | | | 23 | +++++------------------ |
| M | tests/scheme1/67-read-line.scm | | | 2 | ++ |
2 files changed, 7 insertions(+), 18 deletions(-)
diff --git a/tests/scheme1/45-shell-spawn.scm b/tests/scheme1/45-shell-spawn.scm @@ -1,18 +1,5 @@ -; End-to-end shell flow exercising the *prelude's* spawn and run. -; Historically this test redefined `spawn` at user level to dodge a bug -; where `(run prog)` failed with "unbound variable" inside the prelude's -; spawn. With the bug fixed, calling the prelude's `run` directly should -; fork-exec /bin/true and return (#t . 0). -(define (chars->bv . cs) - (let* ((n (length cs)) - (b (make-bytevector n))) - (let loop ((i 0) (xs cs)) - (if (null? xs) b - (begin (bytevector-u8-set! b i (car xs)) - (loop (+ i 1) (cdr xs))))))) - -(define path (chars->bv 47 98 105 110 47 116 114 117 101)) ; "/bin/true" -(define r (run path)) -(if (car r) - (sys-exit (cdr r)) - (sys-exit 99)) +; End-to-end: prelude run/spawn fork-exec /bin/true and decode the +; child's exit. Together with 51 (signal branch) this covers both +; halves of decode-wait-status without raw sys-* poking. +(define r (run "/bin/true")) +(if (car r) (exit (cdr r)) (exit 99)) diff --git a/tests/scheme1/67-read-line.scm b/tests/scheme1/67-read-line.scm @@ -3,10 +3,12 @@ ; bv-concat-reverse via the line-assembly path inside read-line. (define path "/tmp/scheme1-read-line.txt") (define op (open-output path)) +(if (not (car op)) (exit 10) 0) (write-bytes (cdr op) "alpha\nbeta\ngamma\n") (close (cdr op)) (define ip (open-input path)) +(if (not (car ip)) (exit 20) 0) (define p (cdr ip)) (define l1 (read-line p)) (define l2 (read-line p))