diff options
author | Peter Bex <peter@more-magic.net> | 2018-08-16 22:41:12 +0200 |
---|---|---|
committer | Peter Bex <peter@more-magic.net> | 2018-08-16 22:41:12 +0200 |
commit | dd7d5a27716ca0c02314487711f6a9cb32731440 (patch) | |
tree | 72056dc6de4d44d4559b8de4d62c555d6b7d3152 /tests/run.scm | |
parent | b36f392a9a09bb666390260311df358c54cc0f8b (diff) | |
download | scsh-process-dd7d5a27716ca0c02314487711f6a9cb32731440.tar.gz |
Port scsh-process to CHICKEN 5
Thanks to Vasilij Schneidermann for providing an initial patch.
Diffstat (limited to 'tests/run.scm')
-rw-r--r-- | tests/run.scm | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/tests/run.scm b/tests/run.scm index 98b6c25..c4ab584 100644 --- a/tests/run.scm +++ b/tests/run.scm @@ -1,12 +1,27 @@ (module scsh-tests () -(import chicken scheme) - -#;(include "../scsh-process.scm") -(use scsh-process) - -(use test utils extras ports files posix - srfi-13 srfi-18 (only setup-api version>=?)) +(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>=?)))) (test-begin "scsh-process") @@ -116,11 +131,11 @@ (test "Appending to a file" '("blah" "foo") (begin (run (echo foo) (>> ,tmpfile)) - (read-lines tmpfile))) + (with-input-from-file tmpfile read-lines))) (let ((message "testing, 1 2 3")) (test "Redirecting from object" - `("blah" "foo" ,(string-delete #\t message)) + `("blah" "foo" ,"esing, 1 2 3") (run/strings (pipe (epf (tr -d t) (<< ,message)) (cat ,tmpfile -))))) (delete-file* tmpfile))) @@ -129,7 +144,9 @@ (test "run/string with begin form" "hi, there\n" (run/string (pipe (begin (print "hi, there")) (cat)))) - (when (version>=? (chicken-version) "4.8.1") + (when (cond-expand + (chicken-5 #t) + (else (version>=? (chicken-version) "4.8.1"))) (let ((child? #f)) (thread-start! (lambda () (thread-sleep! 0.5) |