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
7ae860e5
Commit
7ae860e5
authored
Oct 20, 2014
by
Matt Bell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commands: Fixed tests
parent
eea2afe3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
command_test.go
command_test.go
+9
-9
response_test.go
response_test.go
+1
-1
No files found.
command_test.go
View file @
7ae860e5
...
...
@@ -13,7 +13,7 @@ func TestOptionValidation(t *testing.T) {
req
:=
NewEmptyRequest
()
req
.
SetOption
(
"foo"
,
5
)
res
:=
cmd
.
Call
(
req
)
res
:=
cmd
.
Call
(
req
,
nil
)
if
res
.
Error
()
==
nil
{
t
.
Error
(
"Should have failed (unrecognized option)"
)
}
...
...
@@ -21,21 +21,21 @@ func TestOptionValidation(t *testing.T) {
req
=
NewEmptyRequest
()
req
.
SetOption
(
"beep"
,
5
)
req
.
SetOption
(
"b"
,
10
)
res
=
cmd
.
Call
(
req
)
res
=
cmd
.
Call
(
req
,
nil
)
if
res
.
Error
()
==
nil
{
t
.
Error
(
"Should have failed (duplicate options)"
)
}
req
=
NewEmptyRequest
()
req
.
SetOption
(
"beep"
,
"foo"
)
res
=
cmd
.
Call
(
req
)
res
=
cmd
.
Call
(
req
,
nil
)
if
res
.
Error
()
==
nil
{
t
.
Error
(
"Should have failed (incorrect type)"
)
}
req
=
NewEmptyRequest
()
req
.
SetOption
(
"beep"
,
5
)
res
=
cmd
.
Call
(
req
)
res
=
cmd
.
Call
(
req
,
nil
)
if
res
.
Error
()
!=
nil
{
t
.
Error
(
res
.
Error
(),
"Should have passed"
)
}
...
...
@@ -43,7 +43,7 @@ func TestOptionValidation(t *testing.T) {
req
=
NewEmptyRequest
()
req
.
SetOption
(
"beep"
,
5
)
req
.
SetOption
(
"boop"
,
"test"
)
res
=
cmd
.
Call
(
req
)
res
=
cmd
.
Call
(
req
,
nil
)
if
res
.
Error
()
!=
nil
{
t
.
Error
(
"Should have passed"
)
}
...
...
@@ -51,28 +51,28 @@ func TestOptionValidation(t *testing.T) {
req
=
NewEmptyRequest
()
req
.
SetOption
(
"b"
,
5
)
req
.
SetOption
(
"B"
,
"test"
)
res
=
cmd
.
Call
(
req
)
res
=
cmd
.
Call
(
req
,
nil
)
if
res
.
Error
()
!=
nil
{
t
.
Error
(
"Should have passed"
)
}
req
=
NewEmptyRequest
()
req
.
SetOption
(
EncShort
,
"json"
)
res
=
cmd
.
Call
(
req
)
res
=
cmd
.
Call
(
req
,
nil
)
if
res
.
Error
()
!=
nil
{
t
.
Error
(
"Should have passed"
)
}
req
=
NewEmptyRequest
()
req
.
SetOption
(
"b"
,
"100"
)
res
=
cmd
.
Call
(
req
)
res
=
cmd
.
Call
(
req
,
nil
)
if
res
.
Error
()
!=
nil
{
t
.
Error
(
"Should have passed"
)
}
req
=
NewEmptyRequest
()
req
.
SetOption
(
"b"
,
":)"
)
res
=
cmd
.
Call
(
req
)
res
=
cmd
.
Call
(
req
,
nil
)
if
res
.
Error
==
nil
{
t
.
Error
(
res
.
Error
,
"Should have failed (string value not convertible to int)"
)
}
...
...
response_test.go
View file @
7ae860e5
...
...
@@ -13,7 +13,7 @@ type TestOutput struct {
func
TestMarshalling
(
t
*
testing
.
T
)
{
req
:=
NewEmptyRequest
()
res
:=
NewResponse
(
req
)
res
:=
NewResponse
(
req
,
nil
)
res
.
SetValue
(
TestOutput
{
"beep"
,
"boop"
,
1337
})
// get command global options so we can set the encoding option
...
...
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