diff options
Diffstat (limited to 'tests/run.scm')
| -rw-r--r-- | tests/run.scm | 60 | 
1 files changed, 25 insertions, 35 deletions
diff --git a/tests/run.scm b/tests/run.scm index b5fa419..85a6b11 100644 --- a/tests/run.scm +++ b/tests/run.scm @@ -1,27 +1,18 @@ +;;(include "../scsh-process.scm")  (module scsh-tests () -(import scheme) - -(cond-expand -  (chicken-5 (import (chicken base) (chicken port) (chicken condition) -                     (chicken io) (chicken file) (chicken file posix) -                     (chicken process signal) -                     (chicken fixnum) ;; Why is this needed?! -                     srfi-18 test) -             #;(include "../scsh-process.scm") -             (import scsh-process) - -             (define (read-all #!optional file-or-port) -               (cond ((string? file-or-port) -                      (with-input-from-file file-or-port read-string)) -                     (file-or-port (read-string #f file-or-port)) -                     (else (read-string)))) -             ) -  (else (import chicken) -        #;(include "../scsh-process.scm") -        (use scsh-process) -        (use test utils extras ports files posix -             srfi-13 srfi-18 (only setup-api version>=?)))) +(import (scheme base) (scheme write) (scheme read) +        (chicken base) (chicken port) (chicken condition) +        (chicken io) (chicken file) (chicken file posix) +        (chicken process signal) +        srfi-18 test) +(import scsh-process) + +(define (read-all #!optional file-or-port) +  (cond ((string? file-or-port) +         (with-input-from-file file-or-port read-string)) +        (file-or-port (read-string #f file-or-port)) +        (else (read-string))))  (test-begin "scsh-process") @@ -149,19 +140,16 @@      (test "run/string with begin form"            "hi, there\n"            (run/string (pipe (begin (print "hi, there")) (cat)))) -    (when (cond-expand -            (chicken-5 #t) -            (else (version>=? (chicken-version) "4.8.1"))) -      (let ((child? #f)) -        (thread-start! (lambda () -                         (thread-sleep! 0.5) -                         (when child? (print "haihai")))) -        (test "Simple 'begin' form with threading" -              "hi, there\n" -              (run/string (pipe (begin (set! child? #t) -                                       (thread-sleep! 1) -                                       (print "hi, there")) -                                (cat)))))) +    (let ((child? #f)) +      (thread-start! (lambda () +                       (thread-sleep! 0.5) +                       (when child? (print "haihai")))) +      (test "Simple 'begin' form with threading" +            "hi, there\n" +            (run/string (pipe (begin (set! child? #t) +                                     (thread-sleep! 1) +                                     (print "hi, there")) +                              (cat)))))      (let ((the-outfile "outfile"))        (test "Subprocess writing to a file" @@ -245,6 +233,8 @@            (|| (false) (epf (sh -c "echo hi && false") (- 1))))))  (test-group "finalization" +  ;; Ensure the automatic reaping thread has a chance to run +  (thread-yield!)    ;; TODO: Find a way to test that the input port didn't get replaced by    ;;       one from a subshell.  This happened before, but not sure how    ;;       to detect this except running it manually from the REPL.  | 
