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
6302356e
Commit
6302356e
authored
Oct 28, 2014
by
Matt Bell
Committed by
Juan Batiz-Benet
Nov 04, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commands: Fixed tests
parent
32a29593
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
commands/cli/parse_test.go
commands/cli/parse_test.go
+6
-2
commands/command_test.go
commands/command_test.go
+1
-1
No files found.
commands/cli/parse_test.go
View file @
6302356e
...
...
@@ -8,12 +8,13 @@ import (
)
func
TestOptionParsing
(
t
*
testing
.
T
)
{
subCmd
:=
&
commands
.
Command
{}
cmd
:=
&
commands
.
Command
{
Options
:
[]
commands
.
Option
{
commands
.
Option
{
Names
:
[]
string
{
"b"
},
Type
:
commands
.
String
},
},
Subcommands
:
map
[
string
]
*
commands
.
Command
{
"test"
:
&
commands
.
Command
{}
,
"test"
:
subCmd
,
},
}
...
...
@@ -37,11 +38,14 @@ func TestOptionParsing(t *testing.T) {
t
.
Error
(
"Should have failed (duplicate option name)"
)
}
path
,
args
:=
parsePath
([]
string
{
"test"
,
"beep"
,
"boop"
},
cmd
)
path
,
args
,
sub
:=
parsePath
([]
string
{
"test"
,
"beep"
,
"boop"
},
cmd
)
if
len
(
path
)
!=
1
||
path
[
0
]
!=
"test"
{
t
.
Errorf
(
"Returned path was defferent than expected: %v"
,
path
)
}
if
len
(
args
)
!=
2
||
args
[
0
]
!=
"beep"
||
args
[
1
]
!=
"boop"
{
t
.
Errorf
(
"Returned args were different than expected: %v"
,
args
)
}
if
sub
!=
subCmd
{
t
.
Errorf
(
"Returned command was different than expected"
)
}
}
commands/command_test.go
View file @
6302356e
...
...
@@ -105,7 +105,7 @@ func TestRegistration(t *testing.T) {
Run
:
noop
,
}
res
:=
cmdB
.
Call
(
NewRequest
([]
string
{
"a"
},
nil
,
nil
,
nil
))
res
:=
cmdB
.
Call
(
NewRequest
([]
string
{
"a"
},
nil
,
nil
,
nil
,
nil
))
if
res
.
Error
()
==
nil
{
t
.
Error
(
"Should have failed (option name collision)"
)
}
...
...
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