Atlas › Test

TestWalkExportedMethods

Exact test identity: go.temporal.io/server/common/testing/temporalapi/TestWalkExportedMethods

Package
go.temporal.io/server/common/testing/temporalapi
Suite / test hierarchy
TestWalkExportedMethods
Test
TestWalkExportedMethods
Introduced at
public_methods.go ×2 Frontier kind: Joint frontier
Covered ranges
2
Covered lines
11
Covered files
1

Covered source

Expand a file to inspect source; the > gutter marks covered lines.

go.temporal.io/server/common/testing/temporalapi/public_methods.go 11 covered LOC · 2 ranges

Open complete file

12 // This prevents the `mustEmbedUnimplementedFooBarBaz` method required by the GRPC v2
13 // gateway from polluting our tests.
14 > func WalkExportedMethods(obj any, cb func(reflect.Method)) { public_methods.go
15 > v := reflect.ValueOf(obj)
16 > if !v.IsValid() {
17 return
18 }
19
20 > t := v.Type() public_methods.go
21 > if t.Kind() == reflect.Pointer {
22 > t = t.Elem()
23 > }
24 > for method := range t.Methods() {
25 > if publicMethodRgx.MatchString(method.Name) {
26 > cb(method)
27 > }
28 }
29 }