Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sharness/t0010: check that all the commands fail when passed a bad flag #4848

Merged
merged 2 commits into from
Mar 23, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions test/sharness/t0010-basic-commands.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ test_expect_success "All commands accept --help" '
while read -r cmd
do
$cmd --help </dev/null >/dev/null ||
{ echo $cmd doesnt accept --help; echo 1 > fail; }
{ echo "$cmd doesnt accept --help"; echo 1 > fail; }
done <commands.txt

if [ $(cat fail) = 1 ]; then
Expand All @@ -80,7 +80,7 @@ test_expect_failure "All ipfs root commands are mentioned in base helptext" '
while read cmd
do
grep " $cmd" help.txt > /dev/null ||
{ echo missing $cmd from helptext; echo 1 > fail; }
{ echo "missing $cmd from helptext"; echo 1 > fail; }
done

if [ $(cat fail) = 1 ]; then
Expand All @@ -94,7 +94,20 @@ test_expect_failure "All ipfs commands docs are 80 columns or less" '
do
LENGTH="$($cmd --help | awk "{ print length }" | sort -nr | head -1)"
[ $LENGTH -gt 80 ] &&
{ echo "$cmd" help text is longer than 79 chars "($LENGTH)"; echo 1 > fail; }
{ echo "$cmd help text is longer than 79 chars ($LENGTH)"; echo 1 > fail; }
done <commands.txt

if [ $(cat fail) = 1 ]; then
return 1
fi
'

test_expect_success "All ipfs commands fail when passed a bad flag" '
echo 0 > fail
while read -r cmd
do
test_must_fail $cmd --badflag >/dev/null ||
{ echo "$cmd exit with code 0 when passed --badflag"; echo 1 > fail; }
done <commands.txt

if [ $(cat fail) = 1 ]; then
Expand Down