Skip to content

Commit c4aedf8

Browse files
committed
test: Fix fails
1 parent d0e1633 commit c4aedf8

File tree

2 files changed

+24
-18
lines changed

2 files changed

+24
-18
lines changed

pkg/lib/traverse-get.sh

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -64,24 +64,25 @@ bash_object.traverse-get() {
6464
# TODO: test these internal invalid errors
6565
# Do nothing (assuming the type is correct), we have already set 'current_object'
6666
# for the next iteration
67-
case "$vmd_dtype" in
68-
object)
69-
if [ "$is_index_of_array" = yes ]; then
70-
bash_object.util.traverse_fail 'ERROR_INTERNAL_INVALID_VOBJ' "Expected object, but reference to array was found"
71-
return
72-
fi
73-
;;
74-
array)
75-
if [ "$is_index_of_array" = no ]; then
76-
bash_object.util.traverse_fail 'ERROR_INTERNAL_INVALID_VOBJ' "Expected array, but reference to object was found"
77-
return
78-
fi
79-
;;
80-
*)
81-
bash_object.util.traverse_fail 'ERROR_INTERNAL_INVALID_VOBJ' "vmd_dtype: $vmd_dtype"
82-
return
83-
;;
84-
esac
67+
:
68+
# case "$vmd_dtype" in
69+
# object)
70+
# if [ "$is_index_of_array" = yes ]; then
71+
# bash_object.util.traverse_fail 'ERROR_INTERNAL_INVALID_VOBJ' "Expected object, but reference to array was found"
72+
# return
73+
# fi
74+
# ;;
75+
# array)
76+
# if [ "$is_index_of_array" = no ]; then
77+
# bash_object.util.traverse_fail 'ERROR_INTERNAL_INVALID_VOBJ' "Expected array, but reference to object was found"
78+
# return
79+
# fi
80+
# ;;
81+
# *)
82+
# bash_object.util.traverse_fail 'ERROR_INTERNAL_INVALID_VOBJ' "vmd_dtype: $vmd_dtype"
83+
# return
84+
# ;;
85+
# esac
8586
elif ((i+1 == ${#REPLIES[@]})); then
8687
# We are last element of query, return the object
8788
if [ "$final_value_type" = object ]; then

tests/get-array.bats

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,9 @@ load './util/init.sh'
8282
assert [ "${REPLY[0]}" = omicron ]
8383
assert [ "${REPLY[1]}" = pi ]
8484
assert [ "${REPLY[2]}" = rho ]
85+
86+
87+
bash_object.traverse-get array OBJECT '.["my_key"].[2].[0]'
88+
89+
assert [ "$REPLY" = omicron ]
8590
}

0 commit comments

Comments
 (0)