micro-tests/proto/unmrashal_test.go
Vasiliy Tolstov 4c0469d1f0
Some checks failed
test / test (push) Failing after 16s
fixup all tests
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2025-01-18 15:17:58 +03:00

28 lines
477 B
Go

package pb
import (
"testing"
cp "go.unistack.org/micro-codec-proto/v3"
)
func TestMarshalUnmarshal(t *testing.T) {
c := cp.NewCodec()
msg2 := &Message2{Items: []*Item2{{Key1: "akey1", Key2: "akey2"}, {Key1: "bkey1", Key2: "bkey2"}}}
buf, err := c.Marshal(msg2)
if err != nil {
t.Fatal(err)
}
msg1 := &Message1{}
err = c.Unmarshal(buf, msg1)
if err != nil {
t.Fatal(err)
}
/*
for _, item := range msg1.Items {
fmt.Printf("item %#+v\n", item)
}
*/
}