File tree Expand file tree Collapse file tree 2 files changed +48
-0
lines changed
cookiecutter/ci/{{ cookiecutter.__project_name }}/tests/scripts Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -80,4 +80,28 @@ expect_deny () {
8080 fi
8181}
8282
83+ # Expects the provided test to pass
84+ # Supresses all output, which is redirected to ASSERTION_OUTPUT and
85+ # ASSERTION_ERROUTPUT so as not to overwrite the latest OUTPUT and ERROUTPUT.
86+ # That way we can test several assertions in a row.
87+ # Reports verbosely on failure.
88+ assert () {
89+ if {
90+ [[ "$@" ]]
91+ } 1>log.out 2>log.err
92+ then
93+ echo "SUCCESS [$@]" >&3
94+ ASSERTION_OUTPUT="$(cat log.out)"
95+ ASSERTION_ERROUTPUT="$(cat log.err)"
96+ else
97+ echo "FAILURE [$@]" >&3
98+ echo "=== STDOUT ===" >&3
99+ cat log.out >&3
100+ echo "=== STDERR ===" >&3
101+ cat log.err >&3
102+ echo "==============" >&3
103+ false
104+ fi
105+ }
106+
83107set -eu
Original file line number Diff line number Diff line change @@ -80,4 +80,28 @@ expect_deny () {
8080 fi
8181}
8282
83+ # Expects the provided test to pass
84+ # Supresses all output, which is redirected to ASSERTION_OUTPUT and
85+ # ASSERTION_ERROUTPUT so as not to overwrite the latest OUTPUT and ERROUTPUT.
86+ # That way we can test several assertions in a row.
87+ # Reports verbosely on failure.
88+ assert () {
89+ if {
90+ [[ "$@" ]]
91+ } 1>log.out 2>log.err
92+ then
93+ echo "SUCCESS [$@]" >&3
94+ ASSERTION_OUTPUT="$(cat log.out)"
95+ ASSERTION_ERROUTPUT="$(cat log.err)"
96+ else
97+ echo "FAILURE [$@]" >&3
98+ echo "=== STDOUT ===" >&3
99+ cat log.out >&3
100+ echo "=== STDERR ===" >&3
101+ cat log.err >&3
102+ echo "==============" >&3
103+ false
104+ fi
105+ }
106+
83107set -eu
You can’t perform that action at this time.
0 commit comments