#!/bin/sh # shellcheck shell=dash oneTimeSetUp() { if [ -n "${VERBOSE:-}" ]; then printf "[INFO] Current shell is: %s\n" "$( "$TEST_TMPDIR/units/one" printf '#!/bin/sh\necho second message' > "$TEST_TMPDIR/units/two" printf '#!/bin/sh\necho oops\nexit 1' > "$TEST_TMPDIR/units/fail" # Make everything executable chmod +x "$TEST_TMPDIR"/units/* # Some groups that to tie things together printf "groups/group2\n" > "$TEST_TMPDIR/groups/group1" printf "units/two\n" > "$TEST_TMPDIR/groups/group2" printf "units/fail\n" > "$TEST_TMPDIR/groups/fail" #tree "$TEST_TMPDIR" } tearDown() { if test -f "$TEST_TMPDIR/.apply_test_dir"; then rm -rf "$TEST_TMPDIR" fi } testRunUnits() { ( cd "$TEST_TMPDIR" ./run units/one units/two ) >"$TEST_TMPDIR/stdout" 2>"$TEST_TMPDIR/stderr" local expected { expected="$(cat)"; } <"$TEST_TMPDIR/stdout" 2>"$TEST_TMPDIR/stderr" set -e local stdout_expected stderr_expected { stdout_expected="$(cat)"; } <"$TEST_TMPDIR/stdout" 2>"$TEST_TMPDIR/stderr" local expected { expected="$(cat)"; } <"$TEST_TMPDIR/stdout" 2>"$TEST_TMPDIR/stderr" local stdout_expected stderr_expected { stdout_expected="$(cat)"; } <