(t *testing.T)
| 174 | } |
| 175 | |
| 176 | func TestInvokes(t *testing.T) { |
| 177 | hello := func(s string) string { |
| 178 | return fmt.Sprintf("Hello %s!", s) |
| 179 | } |
| 180 | hellop := func(s *string) *string { |
| 181 | v := hello(*s) |
| 182 | return &v |
| 183 | } |
| 184 | |
| 185 | testCases := []struct { |
| 186 | name string |
| 187 | input string |
| 188 | expected expected |
| 189 | handler interface{} |
| 190 | options []Option |
| 191 | }{ |
| 192 | { |
| 193 | input: `"Lambda"`, |
| 194 | expected: expected{`null`, nil}, |
| 195 | handler: func(_ string) {}, |
| 196 | }, |
| 197 | { |
| 198 | input: `"Lambda"`, |
| 199 | expected: expected{`"Hello Lambda!"`, nil}, |
| 200 | handler: func(name string) (string, error) { |
| 201 | return hello(name), nil |
| 202 | }, |
| 203 | }, |
| 204 | { |
| 205 | expected: expected{`"Hello No Value!"`, nil}, |
| 206 | handler: func(ctx context.Context) (string, error) { |
| 207 | return hello("No Value"), nil |
| 208 | }, |
| 209 | }, |
| 210 | { |
| 211 | input: `"Lambda"`, |
| 212 | expected: expected{`"Hello Lambda!"`, nil}, |
| 213 | handler: func(ctx context.Context, name string) (string, error) { |
| 214 | return hello(name), nil |
| 215 | }, |
| 216 | }, |
| 217 | { |
| 218 | input: `"Lambda"`, |
| 219 | expected: expected{`"Hello Lambda!"`, nil}, |
| 220 | handler: func(name *string) (*string, error) { |
| 221 | return hellop(name), nil |
| 222 | }, |
| 223 | }, |
| 224 | { |
| 225 | input: `"Lambda"`, |
| 226 | expected: expected{`"Hello Lambda!"`, nil}, |
| 227 | handler: func(name *string) (*string, error) { |
| 228 | return hellop(name), nil |
| 229 | }, |
| 230 | }, |
| 231 | { |
| 232 | input: `"Lambda"`, |
| 233 | expected: expected{`"Hello Lambda!"`, nil}, |
nothing calls this directly
no test coverage detected
searching dependent graphs…