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
ld
go-ld-prime
Commits
bf8ac8c5
Commit
bf8ac8c5
authored
Jul 14, 2021
by
Rod Vagg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove pretty-printing
parent
053176aa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
38 deletions
+5
-38
codec/dagjson/multicodec.go
codec/dagjson/multicodec.go
+2
-2
codec/dagjson/roundtripBytes_test.go
codec/dagjson/roundtripBytes_test.go
+2
-19
codec/dagjson/roundtrip_test.go
codec/dagjson/roundtrip_test.go
+1
-17
No files found.
codec/dagjson/multicodec.go
View file @
bf8ac8c5
...
...
@@ -54,7 +54,7 @@ func Encode(n ipld.Node, w io.Writer) error {
// (There's not really any fastpaths of note for json.)
// Write another function if you need to tune encoding options about whitespace.
return
Marshal
(
n
,
json
.
NewEncoder
(
w
,
json
.
EncodeOptions
{
Line
:
[]
byte
{
'\n'
}
,
Indent
:
[]
byte
{
'\t'
}
,
Line
:
nil
,
Indent
:
nil
,
}),
true
)
}
codec/dagjson/roundtripBytes_test.go
View file @
bf8ac8c5
...
...
@@ -15,15 +15,7 @@ var byteNode = fluent.MustBuildMap(basicnode.Prototype__Map{}, 4, func(na fluent
na
.
AssembleEntry
(
"plain"
)
.
AssignString
(
"olde string"
)
na
.
AssembleEntry
(
"bytes"
)
.
AssignBytes
([]
byte
(
"deadbeef"
))
})
var
byteSerial
=
`{
"plain": "olde string",
"bytes": {
"/": {
"bytes": "ZGVhZGJlZWY="
}
}
}
`
var
byteSerial
=
`{"plain":"olde string","bytes":{"/":{"bytes":"ZGVhZGJlZWY="}}}`
func
TestRoundtripBytes
(
t
*
testing
.
T
)
{
t
.
Run
(
"encoding"
,
func
(
t
*
testing
.
T
)
{
...
...
@@ -46,16 +38,7 @@ var encapsulatedNode = fluent.MustBuildMap(basicnode.Prototype__Map{}, 1, func(n
sa
.
AssembleEntry
(
"bytes"
)
.
AssignBytes
([]
byte
(
"deadbeef"
))
})
})
var
encapsulatedSerial
=
`{
"/": {
"bytes": {
"/": {
"bytes": "ZGVhZGJlZWY="
}
}
}
}
`
var
encapsulatedSerial
=
`{"/":{"bytes":{"/":{"bytes":"ZGVhZGJlZWY="}}}}`
func
TestEncapsulatedBytes
(
t
*
testing
.
T
)
{
t
.
Run
(
"encoding"
,
func
(
t
*
testing
.
T
)
{
...
...
codec/dagjson/roundtrip_test.go
View file @
bf8ac8c5
...
...
@@ -27,23 +27,7 @@ var n = fluent.MustBuildMap(basicnode.Prototype__Map{}, 4, func(na fluent.MapAss
})
})
})
var
serial
=
`{
"plain": "olde string",
"map": {
"one": 1,
"two": 2
},
"list": [
"three",
"four"
],
"nested": {
"deeper": [
"things"
]
}
}
`
var
serial
=
`{"plain":"olde string","map":{"one":1,"two":2},"list":["three","four"],"nested":{"deeper":["things"]}}`
func
TestRoundtrip
(
t
*
testing
.
T
)
{
t
.
Run
(
"encoding"
,
func
(
t
*
testing
.
T
)
{
...
...
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