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
b74f5b93
Commit
b74f5b93
authored
Jan 06, 2015
by
Matt Bell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commands; Fixed tests for Reader output
parent
72872208
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
response_test.go
response_test.go
+9
-4
No files found.
response_test.go
View file @
b74f5b93
package
commands
import
(
"bytes"
"fmt"
"strings"
"testing"
...
...
@@ -27,21 +28,25 @@ func TestMarshalling(t *testing.T) {
req
.
SetOption
(
EncShort
,
JSON
)
bytes
,
err
:=
res
.
Marshal
()
reader
,
err
:=
res
.
Marshal
()
if
err
!=
nil
{
t
.
Error
(
err
,
"Should have passed"
)
}
output
:=
string
(
bytes
)
var
buf
bytes
.
Buffer
buf
.
ReadFrom
(
reader
)
output
:=
buf
.
String
()
if
removeWhitespace
(
output
)
!=
"{
\"
Foo
\"
:
\"
beep
\"
,
\"
Bar
\"
:
\"
boop
\"
,
\"
Baz
\"
:1337}"
{
t
.
Error
(
"Incorrect JSON output"
)
}
res
.
SetError
(
fmt
.
Errorf
(
"Oops!"
),
ErrClient
)
bytes
,
err
=
res
.
Marshal
()
reader
,
err
=
res
.
Marshal
()
if
err
!=
nil
{
t
.
Error
(
"Should have passed"
)
}
output
=
string
(
bytes
)
buf
.
Reset
()
buf
.
ReadFrom
(
reader
)
output
=
buf
.
String
()
fmt
.
Println
(
removeWhitespace
(
output
))
if
removeWhitespace
(
output
)
!=
"{
\"
Message
\"
:
\"
Oops!
\"
,
\"
Code
\"
:1}"
{
t
.
Error
(
"Incorrect JSON output"
)
...
...
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