MCPcopy
hub / github.com/aws/aws-lambda-go / TestInvokes

Function TestInvokes

lambda/handler_test.go:176–454  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

174}
175
176func 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},

Callers

nothing calls this directly

Calls 8

helloFunction · 0.85
WithSetEscapeHTMLFunction · 0.85
WithSetIndentFunction · 0.85
WithUseNumberFunction · 0.85
newHandlerFunction · 0.85
InvokeMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…