3 tests_t
=(json
/{ascii
,depends
,meta
,none
,empty_a
,search
,utf-8
}.json
*)
4 tests_f
=(json
/{empty
,error
}.json
)
6 for t
in "${tests_t[@]}"; do
7 # check if correct amount of entries were parsed
8 cnt1
=$
(aur format
-f '%n\n' "$t" |
wc -l)
10 # variable input formats
13 ascii|depends|search|utf-8|none
)
14 cnt2
=$
(jq
< "$t" '.results | length') ;;
16 cnt2
=$
(jq
< "$t" '. | length') ;;
18 cnt2
=$
(jq
< "$t" -s 'map(.results | length) | add') ;;
20 [[ $cnt1 == "$cnt2" ]]
28 # exit on invalid potion
29 aur format json
/ascii.json
--doesnotexit || err
=$?
31 aur format json
/ascii.json || err
=$?
34 # exit >0 if file path does not exist
35 aur format
-f '%n' /does
/not
/exist || err
=$?
38 # check for errors on invalid inputs
39 aur format
-f '%n' json
/error.json || err
=$?
# response error
42 # check modes with empty stdin
43 printf '' | aur format
-f '%n\n'