Skip to content

Commit

Permalink
Fix in and not_in assertion methods in ZSH<5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
molovo committed Feb 15, 2017
1 parent a0963ec commit a47b4b0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions zunit
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ function _zunit_assert_in() {
[[ $i = $value ]] && found=1
done


[[ $found -eq 1 ]] && return 0

echo "'$value' is not in (${(@f)array})"
Expand Down Expand Up @@ -324,6 +325,9 @@ function run() {
function assert() {
local value=$1 assertion=$2
local -a comparisons

IFS=$'\n'

comparisons=(${(@)@:3})

if [[ -z $assertion ]]; then
Expand All @@ -345,6 +349,8 @@ function assert() {
if [[ $state -ne 0 ]]; then
exit $state
fi

IFS=$oldIFS
}

###
Expand Down

0 comments on commit a47b4b0

Please sign in to comment.