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-cmds
Commits
bbc70ae9
Commit
bbc70ae9
authored
Oct 15, 2014
by
Matt Bell
Committed by
Juan Batiz-Benet
Oct 20, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commands: Added simple Command#Resolve test
parent
951a4109
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
command_test.go
command_test.go
+21
-0
No files found.
command_test.go
View file @
bbc70ae9
...
...
@@ -136,3 +136,24 @@ func TestRegistration(t *testing.T) {
t
.
Error
(
"Should have failed (option name collision with global options)"
)
}
}
func
TestResolving
(
t
*
testing
.
T
)
{
cmd
:=
&
Command
{}
cmdA
:=
&
Command
{}
cmdB
:=
&
Command
{}
cmdB2
:=
&
Command
{}
cmdC
:=
&
Command
{}
cmd
.
Register
(
"a"
,
cmdA
)
cmdA
.
Register
(
"B"
,
cmdB2
)
cmdA
.
Register
(
"b"
,
cmdB
)
cmdB
.
Register
(
"c"
,
cmdC
)
cmds
,
err
:=
cmd
.
Resolve
([]
string
{
"a"
,
"b"
,
"c"
})
if
err
!=
nil
{
t
.
Error
(
err
)
}
if
len
(
cmds
)
!=
4
||
cmds
[
0
]
!=
cmd
||
cmds
[
1
]
!=
cmdA
||
cmds
[
2
]
!=
cmdB
||
cmds
[
3
]
!=
cmdC
{
t
.
Error
(
"Returned command path is different than expected"
,
cmds
)
}
}
\ No newline at end of file
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