Commit bf8ac8c5 authored by Rod Vagg's avatar Rod Vagg

Remove pretty-printing

parent 053176aa
...@@ -54,7 +54,7 @@ func Encode(n ipld.Node, w io.Writer) error { ...@@ -54,7 +54,7 @@ func Encode(n ipld.Node, w io.Writer) error {
// (There's not really any fastpaths of note for json.) // (There's not really any fastpaths of note for json.)
// Write another function if you need to tune encoding options about whitespace. // Write another function if you need to tune encoding options about whitespace.
return Marshal(n, json.NewEncoder(w, json.EncodeOptions{ return Marshal(n, json.NewEncoder(w, json.EncodeOptions{
Line: []byte{'\n'}, Line: nil,
Indent: []byte{'\t'}, Indent: nil,
}), true) }), true)
} }
...@@ -15,15 +15,7 @@ var byteNode = fluent.MustBuildMap(basicnode.Prototype__Map{}, 4, func(na fluent ...@@ -15,15 +15,7 @@ var byteNode = fluent.MustBuildMap(basicnode.Prototype__Map{}, 4, func(na fluent
na.AssembleEntry("plain").AssignString("olde string") na.AssembleEntry("plain").AssignString("olde string")
na.AssembleEntry("bytes").AssignBytes([]byte("deadbeef")) na.AssembleEntry("bytes").AssignBytes([]byte("deadbeef"))
}) })
var byteSerial = `{ var byteSerial = `{"plain":"olde string","bytes":{"/":{"bytes":"ZGVhZGJlZWY="}}}`
"plain": "olde string",
"bytes": {
"/": {
"bytes": "ZGVhZGJlZWY="
}
}
}
`
func TestRoundtripBytes(t *testing.T) { func TestRoundtripBytes(t *testing.T) {
t.Run("encoding", func(t *testing.T) { t.Run("encoding", func(t *testing.T) {
...@@ -46,16 +38,7 @@ var encapsulatedNode = fluent.MustBuildMap(basicnode.Prototype__Map{}, 1, func(n ...@@ -46,16 +38,7 @@ var encapsulatedNode = fluent.MustBuildMap(basicnode.Prototype__Map{}, 1, func(n
sa.AssembleEntry("bytes").AssignBytes([]byte("deadbeef")) sa.AssembleEntry("bytes").AssignBytes([]byte("deadbeef"))
}) })
}) })
var encapsulatedSerial = `{ var encapsulatedSerial = `{"/":{"bytes":{"/":{"bytes":"ZGVhZGJlZWY="}}}}`
"/": {
"bytes": {
"/": {
"bytes": "ZGVhZGJlZWY="
}
}
}
}
`
func TestEncapsulatedBytes(t *testing.T) { func TestEncapsulatedBytes(t *testing.T) {
t.Run("encoding", func(t *testing.T) { t.Run("encoding", func(t *testing.T) {
......
...@@ -27,23 +27,7 @@ var n = fluent.MustBuildMap(basicnode.Prototype__Map{}, 4, func(na fluent.MapAss ...@@ -27,23 +27,7 @@ var n = fluent.MustBuildMap(basicnode.Prototype__Map{}, 4, func(na fluent.MapAss
}) })
}) })
}) })
var serial = `{ var serial = `{"plain":"olde string","map":{"one":1,"two":2},"list":["three","four"],"nested":{"deeper":["things"]}}`
"plain": "olde string",
"map": {
"one": 1,
"two": 2
},
"list": [
"three",
"four"
],
"nested": {
"deeper": [
"things"
]
}
}
`
func TestRoundtrip(t *testing.T) { func TestRoundtrip(t *testing.T) {
t.Run("encoding", func(t *testing.T) { t.Run("encoding", func(t *testing.T) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment