diff options
author | Peter Bex <peter@more-magic.net> | 2012-10-01 18:44:17 +0100 |
---|---|---|
committer | Peter Bex <peter@more-magic.net> | 2012-10-01 18:44:17 +0100 |
commit | 32e9bffa67258b7331dfcf85ffea8fd490bb2333 (patch) | |
tree | 198aab562a626ab7474c4580dea357624e8cca36 /tests | |
parent | 683c1e32c96c657b35468c947a4445709ff08576 (diff) | |
download | scsh-process-32e9bffa67258b7331dfcf85ffea8fd490bb2333.tar.gz |
Some restructuring of the test groupings
Diffstat (limited to 'tests')
-rw-r--r-- | tests/run.scm | 120 |
1 files changed, 62 insertions, 58 deletions
diff --git a/tests/run.scm b/tests/run.scm index 207d705..c0cb01f 100644 --- a/tests/run.scm +++ b/tests/run.scm @@ -16,76 +16,80 @@ (run/string* (lambda () (display "This is a test"))))) (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") + (delete-file* "outfile") ; Leftovers from last run - (test "Simple run/string" - "hi, there\n" - (run/string (echo "hi, there"))) + (test-group "Various run/... forms" + (test "Simple run/string" + "hi, there\n" + (run/string (echo "hi, there"))) - (test "Simple run/sexp" - '("hi, there") - (run/sexp (echo "(\"hi, there\")"))) + (test "Simple run/sexp" + '("hi, there") + (run/sexp (echo "(\"hi, there\")"))) - (test "Simple run/sexps" - '(("hi, there") (a b c)) - (run/sexps (echo "(\"hi, there\") (a b c)"))) + (test "Simple run/sexps" + '(("hi, there") (a b c)) + (run/sexps (echo "(\"hi, there\") (a b c)"))) - (test "Simple run/port" - '(a b c) - (read (run/port (echo "(a b c)")))) + (test "Simple run/port" + '(a b c) + (read (run/port (echo "(a b c)"))))) - (test "Nested output redirection with pipe+" - "foo\n" - (run/string (pipe+ ((1 0)) - (pipe+ ((2 0)) (sh -c "echo foo >&2") (cat)) - (cat)))) + (test-group "Subprocesses" + (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 "&& runs for all true values" - (list #t "bar\n") - (list (&& (epf (echo "foo") (> outfile)) - (true) - (epf (echo "bar") (> outfile))) - (read-all "outfile"))) - (delete-file* "outfile") + (test "Nested output redirection with pipe+" + "foo\n" + (run/string (pipe+ ((1 0)) + (pipe+ ((2 0)) (sh -c "echo foo >&2") (cat)) + (cat))))) - (test "&& stops at first false value and returns false" - (list #f "foo\n") - (list (&& (epf (echo "foo") (> outfile)) - (false) - (epf (echo "bar") (> outfile))) - (read-all "outfile"))) - (delete-file* "outfile") + (test-group "Conditional process sequencing forms" + (test "&& runs for all true values" + (list #t "bar\n") + (list (&& (epf (echo "foo") (> outfile)) + (true) + (epf (echo "bar") (> outfile))) + (read-all "outfile"))) + (delete-file* "outfile") + + (test "&& stops at first false value and returns false" + (list #f "foo\n") + (list (&& (epf (echo "foo") (> outfile)) + (false) + (epf (echo "bar") (> outfile))) + (read-all "outfile"))) + (delete-file* "outfile") - (test "|| stops at first true value and returns true" - (list #t "foo\n") - (list (|| (epf (echo "foo") (> outfile)) + (test "|| stops at first true value and returns true" + (list #t "foo\n") + (list (|| (epf (echo "foo") (> outfile)) (true) (epf (echo "bar") (> outfile))) - (read-all "outfile"))) - (delete-file* "outfile") + (read-all "outfile"))) + (delete-file* "outfile") - (test "|| continues after first false value and returns true" - (list #t "bar\n") - (list (|| (false) + (test "|| continues after first false value and returns true" + (list #t "bar\n") + (list (|| (false) (epf (echo "bar") (> outfile))) - (read-all "outfile"))) - (delete-file* "outfile") + (read-all "outfile"))) + (delete-file* "outfile") - (test "|| continues beyond all false values and returns false" - #f - (|| (false) (epf (sh -c "echo hi && false") (- 1))))) + (test "|| continues beyond all false values and returns false" + #f + (|| (false) (epf (sh -c "echo hi && false") (- 1)))))) (test-exit)
\ No newline at end of file |