File: task.yaml

package info (click to toggle)
snapd 2.71-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 79,536 kB
  • sloc: ansic: 16,114; sh: 16,105; python: 9,941; makefile: 1,890; exp: 190; awk: 40; xml: 22
file content (26 lines) | stat: -rw-r--r-- 836 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
summary: Check commands help

details: |
    This test checks the output for the `snap <CMD> help` command
    follows the expected format and content.

execute: |
    bad=""
    for CMD in $( GO_FLAGS_COMPLETION=1 snap | grep -evFx 'help|blame' ); do
        printf "Checking help for command %-16s" "'$CMD':"
        expected="Usage:\\n\\s+snap $CMD\\b.*\\n\\nThe $CMD command (?s).*\\.\\n"
        actual="$( snap "$CMD" --help )"
        if ! grep -Pzq "$expected" <<<"$actual"; then
            bad=1
            echo
            echo "The output of 'snap $CMD --help' does not match the regular expression"
            echo "'$expected':"
            echo
            echo "----------------"
            echo "$actual"
            echo "----------------"
        else
            echo " Ok."
        fi
    done
    test ! "$bad"