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"
|