Procházet zdrojové kódy

WIP: MarshalIndent

Tao Wen před 8 roky
rodič
revize
91ef89a6a2
1 změnil soubory, kde provedl 13 přidání a 0 odebrání
  1. 13 0
      jsoniter_adapter_test.go

+ 13 - 0
jsoniter_adapter_test.go

@@ -6,6 +6,7 @@ import (
 	"github.com/json-iterator/go/require"
 	"io/ioutil"
 	"testing"
+	"fmt"
 )
 
 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.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))
+}