From 1082067f931558d3fc17688df15ab8fd2d3b50f1 Mon Sep 17 00:00:00 2001 From: Matthew Martin Date: Thu, 12 May 2016 21:39:11 -0500 Subject: [PATCH] tests: Fail on stderr output Closes #291. --- tests/test-highlighting.zsh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/test-highlighting.zsh b/tests/test-highlighting.zsh index 7b547bd..383e92d 100755 --- a/tests/test-highlighting.zsh +++ b/tests/test-highlighting.zsh @@ -140,7 +140,17 @@ run_test() { { # Use a subshell to isolate tests from each other. # (So tests can alter global shell state using 'cd', 'hash', etc) - (run_test_internal "$__tests_tempdir" "$@") + { + # These braces are so multios don't come into play. + { (run_test_internal "$__tests_tempdir" "$@") 3>&1 >&2 2>&3 } | grep \^ + local ret=$pipestatus[1] stderr=$pipestatus[2] + if (( ! stderr )); then + # stdout will become stderr + echo "Bail out! output on stderr"; return 1 + else + return $ret + fi + } 3>&1 >&2 2>&3 } always { rm -rf -- "$__tests_tempdir" }