From: Matt Birkholz Date: Sun, 30 Jul 2017 23:08:33 +0000 (-0700) Subject: tests/runtime/test-syncproc: Enabled, with 3 more basic tests. X-Git-Tag: mit-scheme-pucked-9.2.12~14^2~33 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=9a35110240c54dc33aaef2e3f04453b595c10901;p=mit-scheme.git tests/runtime/test-syncproc: Enabled, with 3 more basic tests. --- diff --git a/tests/check.scm b/tests/check.scm index 5e07df496..28032723b 100644 --- a/tests/check.scm +++ b/tests/check.scm @@ -72,6 +72,7 @@ USA. "runtime/test-string" "runtime/test-string-normalization" "runtime/test-string-search" + "runtime/test-syncproc" "runtime/test-thread-queue" "runtime/test-url" ("runtime/test-wttree" (runtime wt-tree)) diff --git a/tests/runtime/test-syncproc.scm b/tests/runtime/test-syncproc.scm index 4180a6e57..f525d6b41 100644 --- a/tests/runtime/test-syncproc.scm +++ b/tests/runtime/test-syncproc.scm @@ -52,3 +52,31 @@ USA. ;; case Scheme fails the test. (shell "pid=$$; (sleep 2; kill -CONT $pid) & sleep 1; kill -STOP $pid")) (list condition-type:subprocess-stopped)))) + +(define-test 'SUBPROCESS-INPUT + (lambda () + (let ((sample "Lorem ipsum dolor sit amet, consectetur adipiscing elit")) + (call-with-input-string sample + (lambda (in) + (run-shell-command "cat" 'input in 'output #f) + (assert-true (eof-object? (read-char in)))))))) + +(define-test 'SUBPROCESS-OUTPUT + (lambda () + (let* ((reply (call-with-output-string + (lambda (out) + (run-shell-command + "if read; then echo \"Lose\"; else echo \"Win\"; fi" + 'input #f 'output out))))) + (assert-string= reply "Win\n")))) + +(define-test 'SUBPROCESS-IO + (lambda () + (let* ((sample "Lorem ipsum dolor sit amet, consectetur adipiscing elit") + (copy + (call-with-input-string sample + (lambda (in) + (call-with-output-string + (lambda (out) + (run-shell-command "cat" 'input in 'output out))))))) + (assert-string= copy sample)))) \ No newline at end of file