Added `aok' silent tests
parent
76e90de26d
commit
65f6a48fd3
4
src/util
4
src/util
|
@ -42,7 +42,7 @@ aok()
|
||||||
local -i i="${#arr[@]}"
|
local -i i="${#arr[@]}"
|
||||||
|
|
||||||
while ((i--)); do
|
while ((i--)); do
|
||||||
test "${arr[i]}" -eq 0 || return 1
|
test "${arr[i]}" -eq 0 || return
|
||||||
done
|
done &>/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,38 +23,48 @@ describe aok
|
||||||
it succeeds for all zero values
|
it succeeds for all zero values
|
||||||
expect aok 0
|
expect aok 0
|
||||||
to succeed
|
to succeed
|
||||||
|
and to be silent
|
||||||
|
|
||||||
expect aok 0 0 0
|
expect aok 0 0 0
|
||||||
to succeed
|
to succeed
|
||||||
|
and to be silent
|
||||||
end
|
end
|
||||||
|
|
||||||
it fails for any zero values
|
it fails for any zero values
|
||||||
expect aok 1
|
expect aok 1
|
||||||
to fail
|
to fail
|
||||||
|
and to be silent
|
||||||
|
|
||||||
expect aok 1 0 0
|
expect aok 1 0 0
|
||||||
to fail
|
to fail
|
||||||
|
and to be silent
|
||||||
|
|
||||||
expect aok 0 1 0
|
expect aok 0 1 0
|
||||||
to fail
|
to fail
|
||||||
|
and to be silent
|
||||||
|
|
||||||
expect aok 0 0 1
|
expect aok 0 0 1
|
||||||
to fail
|
to fail
|
||||||
|
and to be silent
|
||||||
|
|
||||||
expect aok 1 1 1
|
expect aok 1 1 1
|
||||||
to fail
|
to fail
|
||||||
|
and to be silent
|
||||||
end
|
end
|
||||||
|
|
||||||
# this surely implies a bug in the user's code
|
# this surely implies a bug in the user's code
|
||||||
it fails for any non-numeric values
|
it fails for any non-numeric values
|
||||||
expect aok foo
|
expect aok foo
|
||||||
to fail
|
to fail
|
||||||
|
and to be silent
|
||||||
|
|
||||||
expect aok 0 foo
|
expect aok 0 foo
|
||||||
to fail
|
to fail
|
||||||
|
and to be silent
|
||||||
|
|
||||||
expect aok foo 0
|
expect aok foo 0
|
||||||
to fail
|
to fail
|
||||||
|
and to be silent
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue