From dd7d5a27716ca0c02314487711f6a9cb32731440 Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Thu, 16 Aug 2018 22:41:12 +0200 Subject: Port scsh-process to CHICKEN 5 Thanks to Vasilij Schneidermann for providing an initial patch. --- tests/run.scm | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) (limited to 'tests') 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) -- cgit v1.2.3