From 3a00b7dca1d20812fa28b0cf80d927768f858650 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Tue, 20 Mar 2018 21:07:05 +0100 Subject: [PATCH 1/2] sharness/t0010: check that all the commands fail when passed a bad flag License: MIT Signed-off-by: Christian Couder --- test/sharness/t0010-basic-commands.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/sharness/t0010-basic-commands.sh b/test/sharness/t0010-basic-commands.sh index 63c482aba98..4984de1f05b 100755 --- a/test/sharness/t0010-basic-commands.sh +++ b/test/sharness/t0010-basic-commands.sh @@ -102,6 +102,19 @@ test_expect_failure "All ipfs commands docs are 80 columns or less" ' 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 ' From 30039a78b2489410ceaf69c5920ae2b706286478 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Tue, 20 Mar 2018 22:21:39 +0100 Subject: [PATCH 2/2] sharness/t0010: quote error messages License: MIT Signed-off-by: Christian Couder --- test/sharness/t0010-basic-commands.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/sharness/t0010-basic-commands.sh b/test/sharness/t0010-basic-commands.sh index 4984de1f05b..e9db0c6c181 100755 --- a/test/sharness/t0010-basic-commands.sh +++ b/test/sharness/t0010-basic-commands.sh @@ -66,7 +66,7 @@ test_expect_success "All commands accept --help" ' while read -r cmd do $cmd --help /dev/null || - { echo $cmd doesnt accept --help; echo 1 > fail; } + { echo "$cmd doesnt accept --help"; echo 1 > fail; } done /dev/null || - { echo missing $cmd from helptext; echo 1 > fail; } + { echo "missing $cmd from helptext"; echo 1 > fail; } done if [ $(cat fail) = 1 ]; then @@ -94,7 +94,7 @@ 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 /dev/null || - { echo $cmd exit with code 0 when passed --badflag; echo 1 > fail; } + { echo "$cmd exit with code 0 when passed --badflag"; echo 1 > fail; } done