package protos

import (
	"encoding/json"
	"testing"

	"github.com/golang/protobuf/proto"
)

func TestPack(t *testing.T) {
	s := &S_Login{
		Account: "30",
	}
	name := proto.MessageName(s)
	t.Log(name)

	r := Response{
		MsgId:   1,
		Guid:    20,
		MsgName: "ggd",
	}
	d, err := proto.Marshal(&r)
	if nil != err {
		t.Error("Marshal")
		return
	}
	rr := &Response{}
	err = proto.Unmarshal(d, rr)
	if nil != err {
		t.Error(err)
		return
	}
	t.Log("done")

	ss := []string{"a", "b", "c"}
	t.Log(ss[len(ss)-1])

	bytes, err := json.Marshal(r)

	rrr := &Response{}
	err = json.Unmarshal(bytes, rrr)
	t.Log(rrr.MsgName)
}
