test: fix commands tests
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
Jakub Sztandera committed
Mar 10, 2017 at 18:35 UTC
2317ced4aa2ecb003424fd3df4955e936df8ead2
1 file changed
+7
-5
test/sharness/t0010-basic-commands.sh
+7
-5
@@ -62,26 +62,28 @@ test_expect_success "'ipfs commands' output looks good" '
62
'
63
64
test_expect_success "All commands accept --help" '
65
+ echo 0 > fail
66
while read -r cmd
67
do
68
$cmd --help </dev/null >/dev/null ||
68
- { echo $cmd doesnt accept --help; FAIL=1; }
69
+ { echo $cmd doesnt accept --help; echo 1 > fail; }
70
done <commands.txt
71
71
- if [ ${FAIL-0} = 1 ]; then
72
+ if [ $(cat fail) = 1 ]; then
73
return 1
74
fi
75
'
76
77
test_expect_failure "All ipfs root commands are mentioned in base helptext" '
77
- cut -d" " -f 2 commands.txt | sort -u | \
78
+ echo 0 > fail
79
+ cut -d" " -f 2 commands.txt | grep -v ipfs | sort -u | \
80
while read cmd
81
do
82
grep " $cmd" help.txt > /dev/null ||
81
- { echo missing $cmd from helptext; FAIL=1; }
83
+ { echo missing $cmd from helptext; echo 1 > fail; }
84
done
85
84
- if [ ${FAIL-0} = 1 ]; then
86
+ if [ $(cat fail) = 1 ]; then
87
return 1
88
fi
89
'