1
0
mirror of https://github.com/tmux-plugins/tpm.git synced 2024-06-25 07:27:50 +02:00
tpm/tests/helpers/tpm.sh

14 lines
372 B
Bash
Raw Permalink Normal View History

2015-08-01 22:12:07 +02:00
check_dir_exists_helper() {
2015-08-01 22:24:38 +02:00
[ -d "$1" ]
2015-08-01 22:12:07 +02:00
}
# runs the scripts and asserts it has the correct output and exit code
script_run_helper() {
local script="$1"
local expected_output="$2"
local expected_exit_code="${3:-0}"
2015-08-02 18:38:44 +02:00
$script 2>&1 |
2015-08-01 22:12:07 +02:00
grep "$expected_output" >/dev/null 2>&1 && # grep -q flag quits the script early
[ "${PIPESTATUS[0]}" -eq "$expected_exit_code" ]
}