github.com/volts-dev/volts@v0.0.0-20240120094013-5e9c65924106/codec/codec_test.go (about) 1 package codec 2 3 import ( 4 "testing" 5 ) 6 7 func TestByted(t *testing.T) { 8 t.Log(JSON) 9 str := []byte("你好!") 10 codec := IdentifyCodec(Bytes) 11 out := make([]byte, 0) 12 err := codec.Decode(str, &out) 13 if err != nil { 14 t.Fatal(err) 15 } 16 t.Log(string(out)) 17 } 18 19 func TestFn(t *testing.T) { 20 t.Log(JSON) 21 22 codec := IdentifyCodec(JSON) 23 t.Log(codec.String()) 24 }