git-secret/vendor/bats-core/test/test_helper.bash

30 lines
630 B
Bash
Raw Normal View History

2021-05-03 12:43:04 +00:00
emulate_bats_env() {
export BATS_CWD="$PWD"
export BATS_TEST_FILTER=
export BATS_ROOT_PID=$$
2022-01-17 13:58:05 +00:00
export BATS_RUN_TMPDIR
BATS_RUN_TMPDIR=$(mktemp -d "${BATS_RUN_TMPDIR}/emulated-tmpdir-${BATS_ROOT_PID}-XXXXXX")
2021-05-03 12:43:04 +00:00
}
fixtures() {
FIXTURE_ROOT="$BATS_TEST_DIRNAME/fixtures/$1"
2022-01-17 13:58:05 +00:00
# shellcheck disable=SC2034
2021-05-03 12:43:04 +00:00
RELATIVE_FIXTURE_ROOT="${FIXTURE_ROOT#$BATS_CWD/}"
}
filter_control_sequences() {
"$@" | sed $'s,\x1b\\[[0-9;]*[a-zA-Z],,g'
}
if ! command -v tput >/dev/null; then
tput() {
printf '1000\n'
}
export -f tput
fi
emit_debug_output() {
2022-01-17 13:58:05 +00:00
# shellcheck disable=SC2154
printf '%s\n' 'output:' "$output" >&2
}