github.com/batchcorp/thrift-iterator@v0.0.0-20220918180557-4c4a158fc6e9/test/api/shortcut_test.go (about)

     1  package test
     2  
     3  import (
     4  	"testing"
     5  	"encoding/hex"
     6  	"github.com/stretchr/testify/require"
     7  	"github.com/batchcorp/thrift-iterator"
     8  	"fmt"
     9  )
    10  
    11  func Test_to_json(t *testing.T) {
    12  	should := require.New(t)
    13  	input, err := hex.DecodeString("800100010000000568656c6c6f0000000c0b00010000000a73657373696f6e2d69640c00020c00010a000100000000000000010a000200000000000000000b00030000000f43616c6c46726f6d496e626f756e64000c00020b0001000000093132372e302e302e310a000200000000000004d2000b00030000000568656c6c6f000c00030c00010a000100000000000000020a000200000000000000000b00030000000d52657475726e496e626f756e64000b000200000005776f726c64000f00040c000000010c00020c00010a000100000000000000020a000200000000000000000b00030000000d52657475726e496e626f756e64000b000200000005776f726c64000000")
    14  	should.NoError(err)
    15  	json, err := thrifter.ToJSON(input)
    16  	should.NoError(err)
    17  	fmt.Println(json)
    18  }