Skip to content

Commit

Permalink
[Tests] fix syntax in helper
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jun 10, 2024
1 parent da021e4 commit 3ae1e49
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,16 @@ parse_json() {
buffer=""
local char
local len
len=${#json}
len=$(echo -n "$json" | wc -c)
local i
i=0
local arr_index
arr_index=0
local in_array
in_array=0

for ((i = 0; i < len; i++)); do
char="${json:i:1}"
while [ $i -lt $len ]; do
char=$(echo "$json" | cut -c$((i + 1)))

if [ "$in_string" -eq 1 ]; then
if [ "$escaped" -eq 1 ]; then
Expand Down Expand Up @@ -158,6 +160,7 @@ parse_json() {
else
buffer="$buffer$char"
fi
i=$((i + 1))
continue
fi

Expand Down Expand Up @@ -191,6 +194,7 @@ parse_json() {
fi
;;
esac
i=$((i + 1))
done

printf "%b" "$output"
Expand Down

0 comments on commit 3ae1e49

Please sign in to comment.