2015-09-29 07:02:34 +08:00
|
|
|
|
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'
|
|
|
|
|
}
|
2016-04-28 08:05:33 +08:00
|
|
|
|
|
|
|
|
|
strip_colors() {
|
|
|
|
|
while read -r line; do
|
|
|
|
|
echo "$line" | LC_ALL=C command sed 's/\[[ -?]*[@-~]//g'
|
|
|
|
|
done
|
|
|
|
|
}
|