Skip to content

Commit

Permalink
fix: handler_test.go service name
Browse files Browse the repository at this point in the history
  • Loading branch information
GGXXLL committed Sep 13, 2022
1 parent 06b0160 commit 6a7af45
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions gengokit/handlers/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func TestServerMethsTempl(t *testing.T) {
}
genBytes, err := ioutil.ReadAll(gen)
const expected = `
func (s protoService) ProtoMethod(ctx context.Context, in *pb.RequestMessage) (*pb.ResponseMessage, error){
func (s Service) ProtoMethod(ctx context.Context, in *pb.RequestMessage) (*pb.ResponseMessage, error){
var resp pb.ResponseMessage
return &resp, nil
}
Expand Down Expand Up @@ -221,13 +221,13 @@ func TestIsValidFunc(t *testing.T) {
func init() {}`

const valid = `package p;
func (s protoService) ProtoMethod(context.Context, pb.RequestMessage) (pb.ResponseMessage, error) {}`
func (s Service) ProtoMethod(context.Context, pb.RequestMessage) (pb.ResponseMessage, error) {}`

const invalidRecv = `package p;
func (s fooService) ProtoMethod(context.Context, pb.RequestMessage) (pb.ResponseMessage, error) {}`
func (s Service) ProtoMethod(context.Context, pb.RequestMessage) (pb.ResponseMessage, error) {}`

const invalidFuncName = `package p;
func (generalService) FOOBAR(context.Context, pb.RequestMessage) (pb.ResponseMessage, error) {}`
func (Service) FOOBAR(context.Context, pb.RequestMessage) (pb.ResponseMessage, error) {}`

svcName := strings.ToLower(sd.Service.Name)

Expand Down Expand Up @@ -324,13 +324,13 @@ func TestPruneDecls(t *testing.T) {
}
// ProtoMethod implements Service.
func (s protoService) ProtoMethod(ctx context.Context, in *pb.RequestMessage) (*pb.ResponseMessage, error) {
func (s Service) ProtoMethod(ctx context.Context, in *pb.RequestMessage) (*pb.ResponseMessage, error) {
var resp pb.ResponseMessage
return &resp, nil
}
// FOOBAR implements Service.
func (s protoService) FOOBAR(ctx context.Context, in *pb.RequestMessage) (*pb.ResponseMessage, error) {
func (s Service) FOOBAR(ctx context.Context, in *pb.RequestMessage) (*pb.ResponseMessage, error) {
var resp pb.ResponseMessage
return &resp, nil
}
Expand Down

0 comments on commit 6a7af45

Please sign in to comment.