103-bv-system.scm (999B)
1 ; bytevector variadic constructor, command-line, file-exists? 2 3 ;; --- bytevector constructor ---------------------------------------- 4 (define bv (bytevector 10 20 30 40)) 5 (if (= 4 (bytevector-length bv)) 0 (sys-exit 1)) 6 (if (= 10 (bytevector-u8-ref bv 0)) 0 (sys-exit 2)) 7 (if (= 40 (bytevector-u8-ref bv 3)) 0 (sys-exit 3)) 8 ;; empty bv 9 (define ebv (bytevector)) 10 (if (= 0 (bytevector-length ebv)) 0 (sys-exit 4)) 11 12 ;; --- command-line returns a non-empty list ------------------------- 13 (define cl (command-line)) 14 (if (pair? cl) 0 (sys-exit 5)) 15 16 ;; --- file-exists? -------------------------------------------------- 17 ;; Round-trip through the shell to avoid depending on the test 18 ;; harness's cwd or any committed file path. 19 (define rc (run "/bin/sh" "-c" "echo > /tmp/scheme1-fe.txt")) 20 (if (and (car rc) (zero? (cdr rc))) 0 (sys-exit 6)) 21 22 (if (file-exists? "/tmp/scheme1-fe.txt") 0 (sys-exit 7)) 23 (if (not (file-exists? "/tmp/scheme1-no-such-xyz.txt")) 0 (sys-exit 8)) 24 25 (sys-exit 9)