1
0
mirror of https://github.com/sstephenson/bats.git synced 2024-11-17 11:42:33 +01:00
bats/test/test_helper.bash
Mike Bland 1ed87ecb7f test/bats: Add fake tput to fix Alpine tests
The test cases that use the `-p` or `--pretty` flag would fail if `tput`
wasn't available (installed as part of the `ncurses` package). On
Alpine, `ncurses` isn't installed by default. This change ensures the
tests validate the expected behavior regardless of whether `tput` is
available.
2017-10-03 13:24:06 -07:00

24 lines
395 B
Bash

fixtures() {
FIXTURE_ROOT="$BATS_TEST_DIRNAME/fixtures/$1"
bats_trim_filename "$FIXTURE_ROOT" 'RELATIVE_FIXTURE_ROOT'
}
setup() {
export TMP="$BATS_TEST_DIRNAME/tmp"
}
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
teardown() {
[ -d "$TMP" ] && rm -f "$TMP"/*
}