issue/1062: update dependency count for aurutils
[aurutils.git] / tests / issue / 1062
blob2812309768d960fb62b5454b77fdc1cfdb35b6df
1 #!/bin/bash
2 set -e
3 check_pairs() {
4 # datamash distinguishes empty and missing fields, so a manual
5 # implementation is needed
6 awk -F'\t' '{
7 if($2 == "" || $1 == "") {
8 print "empty field encountered on line" " " NR >"/dev/stderr"
9 exit(1)
14 check_table() {
15 datamash -W check
18 check_count() {
19 local cnt=$1 exp=$2
21 if (( cnt != exp )); then
22 echo >&2 "$cnt fields encountered, expected $exp"
23 exit 1
24 else
25 echo >&2 "$cnt fields"
29 # check consistent output
30 aur depends git aurutils 2>/dev/null | check_pairs
31 aur depends --all git aurutils 2>/dev/null | check_pairs
32 aur depends --table git aurutils 2>/dev/null | check_table
33 aur depends --table -r git aurutils 2>/dev/null | check_table
35 # git is non-AUR dependency specified on command-line
36 cnt=$(aur depends --json git aurutils | jq length)
37 check_count "$cnt" 1
39 # single AUR dependency from command-line
40 cnt=$(aur depends --json aurutils | jq length)
41 check_count "$cnt" 1
43 # git is included as non-AUR dependency for aurutils
44 cnt=$(aur depends --json --all git aurutils | jq length)
45 check_count "$cnt" 6
47 # list all direct dependencies
48 cnt=$(aur depends --json --all aurutils | jq length)
49 check_count "$cnt" 6