diff --git a/lint_requirements.txt b/lint_requirements.txt index f7e27d6..1246a40 100644 --- a/lint_requirements.txt +++ b/lint_requirements.txt @@ -1,5 +1,5 @@ # Lint requirements -ruff~=0.15.0 +ruff~=0.15.1 mypy~=1.19.1 shellcheck-py~=0.11.0.1 diff --git a/tests/scripts/config.source b/tests/scripts/config.source index 5901cc6..cfa0a62 100644 --- a/tests/scripts/config.source +++ b/tests/scripts/config.source @@ -80,4 +80,28 @@ expect_deny () { fi } +# Expects the provided test to pass +# Supresses all output, which is redirected to ASSERTION_OUTPUT and +# ASSERTION_ERROUTPUT so as not to overwrite the latest OUTPUT and ERROUTPUT. +# That way we can test several assertions in a row. +# Reports verbosely on failure. +assert () { + if { + [[ "$@" ]] + } 1>log.out 2>log.err + then + echo "SUCCESS [$@]" >&3 + ASSERTION_OUTPUT="$(cat log.out)" + ASSERTION_ERROUTPUT="$(cat log.err)" + else + echo "FAILURE [$@]" >&3 + echo "=== STDOUT ===" >&3 + cat log.out >&3 + echo "=== STDERR ===" >&3 + cat log.err >&3 + echo "==============" >&3 + false + fi +} + set -eu