| 204 | } |
| 205 | |
| 206 | func 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 | |
| 225 | func TestMethodExprIsPayloadStreaming(t *testing.T) { |
| 226 | cases := map[string]struct { |