Skip to content

Commit 9586aa3

Browse files
committed
Beef up assert_contains to match bats-assert PR
1 parent 508f465 commit 9586aa3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

test/helpers.bash

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@ refute_exists() {
88

99
assert_contains() {
1010
local item
11-
local items=(${@:2})
12-
for item in "${items[@]}"; do
11+
for item in "${@:2}"; do
1312
if [[ "$item" == "$1" ]]; then
1413
return 0
1514
fi
1615
done
1716

18-
fail "$1 not found in: ${items[@]}"
17+
batslib_print_kv_single_or_multi 8 \
18+
'expected' "$1" \
19+
'actual' "$(echo ${@:2})" \
20+
| batslib_decorate 'item was not found in the array' \
21+
| fail
1922
}
2023

2124
setupNotesEnv() {

0 commit comments

Comments
 (0)