Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
53fe9c9b
Commit
53fe9c9b
authored
Oct 09, 2018
by
Kejie Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add ipfs help sub-command test
License: MIT Signed-off-by:
Kejie Zhang
<
601172892@qq.com
>
parent
08c75aa7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
36 deletions
+21
-36
cmd/ipfs/main.go
cmd/ipfs/main.go
+6
-2
test/sharness/t0010-basic-commands.sh
test/sharness/t0010-basic-commands.sh
+15
-20
test/sharness/t0060-daemon.sh
test/sharness/t0060-daemon.sh
+0
-10
test/sharness/t0100-name.sh
test/sharness/t0100-name.sh
+0
-4
No files found.
cmd/ipfs/main.go
View file @
53fe9c9b
...
...
@@ -93,9 +93,13 @@ func mainRet() int {
if
os
.
Args
[
1
]
==
"help"
{
if
len
(
os
.
Args
)
>
2
{
os
.
Args
=
append
(
os
.
Args
[
:
1
],
os
.
Args
[
2
:
]
...
)
os
.
Args
=
append
(
os
.
Args
,
"-h"
)
// Handle `ipfs help --help`
// append `--help`,when the command is not `ipfs help --help`
if
os
.
Args
[
1
]
!=
"--help"
{
os
.
Args
=
append
(
os
.
Args
,
"--help"
)
}
}
else
{
os
.
Args
[
1
]
=
"-
h
"
os
.
Args
[
1
]
=
"-
-help
"
}
}
}
...
...
test/sharness/t0010-basic-commands.sh
View file @
53fe9c9b
...
...
@@ -41,26 +41,6 @@ test_expect_success "ipfs version --all has all required fields" '
grep "Golang version" version_all.txt
'
test_expect_success
"ipfs help succeeds"
'
ipfs help >help.txt
'
test_expect_success
"ipfs help output looks good"
'
egrep -i "^Usage" help.txt >/dev/null &&
egrep "ipfs <command>" help.txt >/dev/null ||
test_fsh cat help.txt
'
test_expect_success
"ipfs help --help succeeds"
'
ipfs help --help >help.txt
'
test_expect_success
"ipfs help --help output looks good"
'
egrep -i "^Usage" help.txt >/dev/null &&
egrep "ipfs <command>" help.txt >/dev/null ||
test_fsh cat help.txt
'
test_expect_success
"'ipfs commands' succeeds"
'
ipfs commands >commands.txt
'
...
...
@@ -71,6 +51,21 @@ test_expect_success "'ipfs commands' output looks good" '
grep "ipfs update" commands.txt
'
test_expect_success
"All sub-commands accept help"
'
echo 0 > fail
while read -r cmd
do
${cmd:0:4} help ${cmd:5} >/dev/null ||
{ echo "$cmd doesnt accept --help"; echo 1 > fail; }
echo stuff | $cmd --help >/dev/null ||
{ echo "$cmd doesnt accept --help when using stdin"; echo 1 > fail; }
done <commands.txt
if [ $(cat fail) = 1 ]; then
return 1
fi
'
test_expect_success
"All commands accept --help"
'
echo 0 > fail
while read -r cmd
...
...
test/sharness/t0060-daemon.sh
View file @
53fe9c9b
...
...
@@ -80,16 +80,6 @@ test_expect_success "ipfs help output looks good" '
test_fsh cat help.txt
'
test_expect_success
"ipfs help --help succeeds"
'
ipfs help --help >help.txt
'
test_expect_success
"ipfs help --help output looks good"
'
egrep -i "^Usage" help.txt >/dev/null &&
egrep "ipfs .* <command>" help.txt >/dev/null ||
test_fsh cat help.txt
'
# netcat (nc) is needed for the following test
test_expect_success
"nc is available"
'
type nc >/dev/null
...
...
test/sharness/t0100-name.sh
View file @
53fe9c9b
...
...
@@ -158,10 +158,6 @@ test_expect_success "'ipfs name publish --help' succeeds" '
ipfs name publish --help
'
test_expect_success
"'ipfs help name publish' succeeds"
'
ipfs help name publish
'
test_launch_ipfs_daemon
test_expect_success
"empty request to name publish doesn't panic and returns error"
'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment