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
e0719843
Commit
e0719843
authored
Oct 10, 2014
by
Matt Bell
Committed by
Juan Batiz-Benet
Oct 20, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commands: Added global options list to command tests
parent
4537b96f
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 @
e0719843
...
@@ -57,6 +57,13 @@ func TestOptionValidation(t *testing.T) {
...
@@ -57,6 +57,13 @@ func TestOptionValidation(t *testing.T) {
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
(
"Should have passed"
)
t
.
Error
(
"Should have passed"
)
}
}
req
=
NewRequest
()
req
.
options
[
"enc"
]
=
"json"
_
,
err
=
cmd
.
Call
(
nil
,
req
)
if
err
!=
nil
{
t
.
Error
(
"Should have passed"
)
}
}
}
func
TestRegistration
(
t
*
testing
.
T
)
{
func
TestRegistration
(
t
*
testing
.
T
)
{
...
@@ -96,6 +103,15 @@ func TestRegistration(t *testing.T) {
...
@@ -96,6 +103,15 @@ func TestRegistration(t *testing.T) {
return
nil
,
nil
return
nil
,
nil
},
},
},
},
&
Command
{
Options
:
[]
Option
{
Option
{
[]
string
{
"enc"
},
String
},
},
f
:
func
(
req
*
Request
)
(
interface
{},
error
)
{
return
nil
,
nil
},
},
}
}
err
:=
cmds
[
0
]
.
Register
(
"foo"
,
cmds
[
1
])
err
:=
cmds
[
0
]
.
Register
(
"foo"
,
cmds
[
1
])
...
@@ -112,4 +128,9 @@ func TestRegistration(t *testing.T) {
...
@@ -112,4 +128,9 @@ func TestRegistration(t *testing.T) {
if
err
==
nil
{
if
err
==
nil
{
t
.
Error
(
"Should have failed (subcommand name collision)"
)
t
.
Error
(
"Should have failed (subcommand name collision)"
)
}
}
err
=
cmds
[
0
]
.
Register
(
"baz"
,
cmds
[
4
])
if
err
==
nil
{
t
.
Error
(
"Should have failed (option name collision with global options)"
)
}
}
}
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