diff --git a/zunit b/zunit index aa2eea6..9bf6c77 100755 --- a/zunit +++ b/zunit @@ -118,13 +118,18 @@ function _zunit_assert_in() { local -a array array=(${(@)@:2}) + local oldIFS=$IFS + IFS=$'\n' + for i in ${(@f)array}; do [[ $i = $value ]] && found=1 done + [[ $found -eq 1 ]] && return 0 echo "'$value' is not in (${(@f)array})" + IFS=$oldIFS exit 1 } @@ -136,6 +141,9 @@ function _zunit_assert_not_in() { local -a array array=(${(@)@:2}) + local oldIFS=$IFS + IFS=$'\n' + for i in ${(@f)array}; do [[ $i = $value ]] && found=1 done @@ -143,6 +151,7 @@ function _zunit_assert_not_in() { [[ $found -eq 0 ]] && return 0 echo "'$value' is in (${(@f)array})" + IFS=$oldIFS exit 1 }