diff options
author | Peter Bex <peter@more-magic.net> | 2012-10-01 16:52:59 +0100 |
---|---|---|
committer | Peter Bex <peter@more-magic.net> | 2012-10-01 16:52:59 +0100 |
commit | 9a9895123961e426afbaf33b6662f190f58f0dd7 (patch) | |
tree | f54707c6229337fdd8c5ae668910876b34b7c403 /test/run.scm | |
parent | 13be7874d50b16ec950ee6e07e9849107314cf4d (diff) | |
download | scsh-process-9a9895123961e426afbaf33b6662f190f58f0dd7.tar.gz |
Provide a more complete set of primitives, and convert fit-pipes to fork/pipe+ chain
Diffstat (limited to 'test/run.scm')
-rw-r--r-- | test/run.scm | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/run.scm b/test/run.scm new file mode 100644 index 0000000..1256845 --- /dev/null +++ b/test/run.scm @@ -0,0 +1,38 @@ +(include "../scsh-process.scm") +(import scsh-process) + +(use test posix) + +(test-group "Procedural interface" + (test "Fork/pipe \"hello world\" example from SCSH reference manual" + "Hello, world." + (begin (fork/pipe + (lambda () + (with-output-to-port (open-output-file* 1) + (lambda () (display "Hello, world.\n") (exit 0))))) + (read-line (open-input-file* 0)))) + (test "run/string* returns a string output in a subprocess" + "This is a test" + (run/string* (lambda () (display "This is a test") (exit 0))))) + +(test-group "Macro (EPF) interface" + (delete-file* "outfile") ; Leftovers + (let ((outfile "outfile")) + (test "Subprocess writing to a file" + "hi, there\n" + (begin (run (echo "hi, there") (> ,outfile)) + (read-all "outfile")))) + + (delete-file* "outfile") + (let ((echo-command 'echo)) + (test "Subprocess piped to another process, writing to a file" + "1235\n" + (begin (run (pipe (,echo-command "1234" + 1) ("bc")) (> outfile)) + (read-all "outfile")))) + (delete-file* "outfile") + + (test "Simple run/string" + "hi, there\n" + (run/string (echo "hi, there")))) + +(test-exit)
\ No newline at end of file |