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-unixfs
Commits
f437230d
Commit
f437230d
authored
10 years ago
by
Matt Bell
Committed by
Juan Batiz-Benet
10 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commands/cli: Added path/args test
parent
4bd3a777
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
commands/cli/parse_test.go
commands/cli/parse_test.go
+15
-0
No files found.
commands/cli/parse_test.go
View file @
f437230d
...
...
@@ -3,6 +3,8 @@ package cli
import
(
//"fmt"
"testing"
"github.com/jbenet/go-ipfs/commands"
)
func
TestOptionParsing
(
t
*
testing
.
T
)
{
...
...
@@ -20,4 +22,17 @@ func TestOptionParsing(t *testing.T) {
if
len
(
input
)
!=
2
||
input
[
0
]
!=
"test"
||
input
[
1
]
!=
"test2"
{
t
.
Error
(
"Returned input was different than expected: %v"
,
input
)
}
cmd
:=
&
commands
.
Command
{}
cmd
.
Register
(
"test"
,
&
commands
.
Command
{})
path
,
args
,
err
:=
path
([]
string
{
"test"
,
"beep"
,
"boop"
},
cmd
)
if
err
!=
nil
{
t
.
Error
(
"Should have passed"
)
}
if
len
(
path
)
!=
1
||
path
[
0
]
!=
"test"
{
t
.
Error
(
"Returned path was defferent than expected: %v"
,
path
)
}
if
len
(
args
)
!=
2
||
args
[
0
]
!=
"beep"
||
args
[
1
]
!=
"boop"
{
t
.
Error
(
"Returned args were different than expected: %v"
,
args
)
}
}
This diff is collapsed.
Click to expand it.
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