tests/runtime/test-syncproc: Enabled, with 3 more basic tests.
authorMatt Birkholz <matt@birchwood-abbey.net>
Sun, 30 Jul 2017 23:08:33 +0000 (16:08 -0700)
committerMatt Birkholz <matt@birchwood-abbey.net>
Sun, 30 Jul 2017 23:08:33 +0000 (16:08 -0700)
tests/check.scm
tests/runtime/test-syncproc.scm

index 5e07df4964b7b6af4d0d562b53fca14e2d27ea86..28032723be9a08ec97ef2b7ddacfc9135d19a0f9 100644 (file)
@@ -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))
index 4180a6e573b1c53af25eac95a0f92976bad4cf06..f525d6b41c29a0f5da21f4f9bda07d7bef6ef1e0 100644 (file)
@@ -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