|
@@ -68,3 +68,14 @@ func Test_marshal_indent(t *testing.T) {
|
|
|
should.Nil(err)
|
|
should.Nil(err)
|
|
|
should.Equal("{\n \"F1\": 1,\n \"F2\": [\n 2,\n 3,\n 4\n ]\n}", string(output))
|
|
should.Equal("{\n \"F1\": 1,\n \"F2\": [\n 2,\n 3,\n 4\n ]\n}", string(output))
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+func Test_marshal_indent_map(t *testing.T) {
|
|
|
|
|
+ should := require.New(t)
|
|
|
|
|
+ obj := map[int]int{1: 2}
|
|
|
|
|
+ output, err := json.MarshalIndent(obj, "", " ")
|
|
|
|
|
+ should.Nil(err)
|
|
|
|
|
+ should.Equal("{\n \"1\": 2\n}", string(output))
|
|
|
|
|
+ output, err = MarshalIndent(obj, "", " ")
|
|
|
|
|
+ should.Nil(err)
|
|
|
|
|
+ should.Equal("{\n \"1\": 2\n}", string(output))
|
|
|
|
|
+}
|