nvm/test/common.sh

20 lines
371 B
Bash
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

assert_ok() {
local FUNCTION=$1
shift
$($FUNCTION $@) || die '"'"$FUNCTION $@"'" should have succeeded, but failed'
}
assert_not_ok() {
local FUNCTION=$1
shift
! $($FUNCTION $@) || die '"'"$FUNCTION $@"'" should have failed, but succeeded'
}
strip_colors() {
while read -r line; do
echo "$line" | LC_ALL=C command sed 's/\[[ -?]*[@-~]//g'
done
}