mirror of
https://github.com/smallnest/rpcx.git
synced 2025-10-06 00:26:58 +08:00
29 lines
501 B
Go
29 lines
501 B
Go
package reflection
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/kr/pretty"
|
|
|
|
testutils "github.com/smallnest/rpcx/_testutils"
|
|
)
|
|
|
|
type PBArith int
|
|
|
|
func (t *PBArith) Mul(ctx context.Context, args *testutils.ProtoArgs, reply *testutils.ProtoReply) error {
|
|
reply.C = args.A * args.B
|
|
return nil
|
|
}
|
|
|
|
func TestReflection_Register(t *testing.T) {
|
|
r := New()
|
|
arith := PBArith(0)
|
|
err := r.Register("Arith", &arith, "")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
pretty.Println(r.Services["PBArith"].String())
|
|
}
|