From 8b6689df84f21ce709249c5c2ca8dbdfb87282eb Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Mon, 1 Oct 2012 17:30:42 +0100 Subject: Rename test directory to tests (thanks Moritz!) --- test/run.scm | 52 ---------------------------------------------------- tests/run.scm | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 52 deletions(-) delete mode 100644 test/run.scm create mode 100644 tests/run.scm diff --git a/test/run.scm b/test/run.scm deleted file mode 100644 index d190c95..0000000 --- a/test/run.scm +++ /dev/null @@ -1,52 +0,0 @@ -(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 "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 "Nested output redirection with pipe+" - "foo\n" - (run/string (pipe+ ((1 0)) - (pipe+ ((2 0)) (sh -c "echo foo >&2") (cat)) - (cat))))) - -(test-exit) \ No newline at end of file diff --git a/tests/run.scm b/tests/run.scm new file mode 100644 index 0000000..c0a2a7e --- /dev/null +++ b/tests/run.scm @@ -0,0 +1,56 @@ +(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 "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/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-exit) \ No newline at end of file -- cgit v1.2.3