mirror of
https://github.com/json-iterator/go.git
synced 2025-05-13 21:36:29 +02:00
WIP: MarshalIndent
This commit is contained in:
parent
3e3caf9184
commit
91ef89a6a2
@ -6,6 +6,7 @@ import (
|
|||||||
"github.com/json-iterator/go/require"
|
"github.com/json-iterator/go/require"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"testing"
|
"testing"
|
||||||
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_new_decoder(t *testing.T) {
|
func Test_new_decoder(t *testing.T) {
|
||||||
@ -68,3 +69,15 @@ func Test_use_number_for_unmarshal(t *testing.T) {
|
|||||||
should.Nil(api.UnmarshalFromString("123", &obj))
|
should.Nil(api.UnmarshalFromString("123", &obj))
|
||||||
should.Equal(json.Number("123"), obj)
|
should.Equal(json.Number("123"), obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Test_marshal_indent(t *testing.T) {
|
||||||
|
t.Skip("WIP")
|
||||||
|
should := require.New(t)
|
||||||
|
output, err := json.MarshalIndent(struct{
|
||||||
|
F1 int
|
||||||
|
F2 []int
|
||||||
|
}{1, []int{2, 3, 4}}, "", " ")
|
||||||
|
should.Nil(err)
|
||||||
|
fmt.Println(string(output))
|
||||||
|
should.Equal("{\nab\"F1\": 1,\nab\"F2\": 2\na}", string(output))
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user