diff options
Diffstat (limited to 'tests/run.scm')
-rw-r--r-- | tests/run.scm | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/tests/run.scm b/tests/run.scm index c0a2a7e..23220e1 100644 --- a/tests/run.scm +++ b/tests/run.scm @@ -51,6 +51,41 @@ "foo\n" (run/string (pipe+ ((1 0)) (pipe+ ((2 0)) (sh -c "echo foo >&2") (cat)) - (cat))))) + (cat)))) + + (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)) + (true) + (epf (echo "bar") (> outfile))) + (read-all "outfile"))) + (delete-file* "outfile") + + (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") + + (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 |