micro-tests/codec/frame_test.go
Vasiliy Tolstov 88a4c1641d reformat
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-01-24 22:44:39 +03:00

25 lines
478 B
Go

package codec
import (
"fmt"
"testing"
jsoncodec "go.unistack.org/micro-codec-json/v3"
"go.unistack.org/micro/v3/codec"
)
func TestFrame(t *testing.T) {
type FrameStruct struct {
Frame *codec.Frame `json:"frame"`
Name string `json:"name"`
}
dst := &FrameStruct{}
data := []byte(`{"name":"test","frame": {"first":"second"}}`)
c := jsoncodec.NewCodec()
if err := c.Unmarshal(data, dst); err != nil {
t.Fatal(err)
}
fmt.Printf("xxx %s\n", dst.Frame)
}