MCPcopy Create free account
hub / github.com/goadesign/goa / TestMethodExprEvalName

Function TestMethodExprEvalName

expr/method_test.go:206–223  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

204}
205
206func TestMethodExprEvalName(t *testing.T) {
207 cases := map[string]struct {
208 name string
209 service *expr.ServiceExpr
210 expected string
211 }{
212 "unnamed": {name: "", service: nil, expected: "unnamed method"},
213 "foo": {name: "foo", service: nil, expected: fmt.Sprintf("method %#v", "foo")},
214 "bar": {name: "bar", service: &expr.ServiceExpr{Name: ""}, expected: fmt.Sprintf("unnamed service method %#v", "bar")},
215 "baz": {name: "baz", service: &expr.ServiceExpr{Name: "baz service"}, expected: fmt.Sprintf("service %#v method %#v", "baz service", "baz")},
216 }
217 for k, tc := range cases {
218 m := expr.MethodExpr{Name: tc.name, Service: tc.service}
219 if actual := m.EvalName(); actual != tc.expected {
220 t.Errorf("%s: got %#v, expected %#v", k, actual, tc.expected)
221 }
222 }
223}
224
225func TestMethodExprIsPayloadStreaming(t *testing.T) {
226 cases := map[string]struct {

Callers

nothing calls this directly

Calls 1

EvalNameMethod · 0.95

Tested by

no test coverage detected