Skip to content

Add 80 columns mans tests #3774

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

Merged
merged 2 commits into from
Mar 10, 2017
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
26 changes: 21 additions & 5 deletions test/sharness/t0010-basic-commands.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,26 +62,42 @@ test_expect_success "'ipfs commands' output looks good" '
'

test_expect_success "All commands accept --help" '
echo 0 > fail
while read -r cmd
do
$cmd --help </dev/null >/dev/null ||
{ echo $cmd doesnt accept --help; FAIL=1; }
{ echo $cmd doesnt accept --help; echo 1 > fail; }
done <commands.txt

if [ ${FAIL-0} = 1 ]; then
if [ $(cat fail) = 1 ]; then
return 1
fi
'

test_expect_failure "All ipfs root commands are mentioned in base helptext" '
cut -d" " -f 2 commands.txt | sort -u | \
echo 0 > fail
cut -d" " -f 2 commands.txt | grep -v ipfs | sort -u | \
while read cmd
do
grep " $cmd" help.txt > /dev/null ||
{ echo missing $cmd from helptext; FAIL=1; }
{ echo missing $cmd from helptext; echo 1 > fail; }
done

if [ ${FAIL-0} = 1 ]; then
if [ $(cat fail) = 1 ]; then
return 1
fi
'

test_expect_failure "All ipfs commands docs are 80 columns or less" '
echo 0 > fail
while read cmd
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; }
done <commands.txt

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