summaryrefslogtreecommitdiff
path: root/test/command-parsing.sh
blob: 008cb77cec5fb4e8bf9dfd30811fe55d3ac7094a (plain) (blame)
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
#!/bin/sh

fail=0

help_output=$(../src/apk version --help 2>/dev/null)
invalid_option_output="$(../src/apk --invalid-option version 2>/dev/null)"
if [ "$help_output" != "$invalid_option_output" ]; then
	echo "FAIL: invalid option does not trigger help"
	fail=$((fail+1))
fi

if ! ../src/apk --help 2>/dev/null | grep -q "^Use apk --help --verbose for a full command listing."; then
	echo "FAIL: brief help gives long help"
	fail=$((fail+1))
fi

if ../src/apk --help --verbose 2>/dev/null | grep -q "^Use apk --help --verbose for a full command listing."; then
	echo "FAIL: long help does not work"
	fail=$((fail+1))
fi

if [ $fail -eq 0 ]; then
	echo "OK: command parsing works"
fi

exit $fail