26 lines
597 B
Scheme
26 lines
597 B
Scheme
(import (scheme base)
|
|
(scheme write)
|
|
(scheme file)
|
|
(scheme process-context)
|
|
(foreign c)
|
|
(retropikzel system)
|
|
(srfi 64))
|
|
|
|
(test-begin "foreign-c-system")
|
|
|
|
(define testfile "/tmp/foreign-c-system-test.txt")
|
|
|
|
(define exit-code1 (system (apply string-append `("echo \"Hello\" > " ,testfile))))
|
|
|
|
(test-assert (= exit-code1 0))
|
|
|
|
(define text (with-input-from-file testfile (lambda () (read-line))))
|
|
|
|
(test-assert (string=? text "Hello"))
|
|
|
|
(define exit-code2 (system "no-such-command"))
|
|
|
|
(test-assert (not (= exit-code1 0)))
|
|
|
|
(test-end "foreign-c-system")
|