MCPcopy
hub / github.com/gofiber/fiber / Test_App_Stack

Function Test_App_Stack

app_test.go:2623–2648  ·  view source on GitHub ↗

go test -run Test_App_Stack

(t *testing.T)

Source from the content-addressed store, hash-verified

2621
2622// go test -run Test_App_Stack
2623func Test_App_Stack(t *testing.T) {
2624 t.Parallel()
2625 app := New()
2626
2627 app.Use("/path0", testEmptyHandler)
2628 app.Get("/path1", testEmptyHandler)
2629 app.Get("/path2", testEmptyHandler)
2630 app.Post("/path3", testEmptyHandler)
2631 app.Query("/path4", testEmptyHandler)
2632
2633 app.startupProcess()
2634
2635 stack := app.Stack()
2636 methodList := app.config.RequestMethods
2637 require.Len(t, methodList, len(stack))
2638 require.Len(t, stack[app.methodInt(MethodGet)], 3)
2639 require.Len(t, stack[app.methodInt(MethodHead)], 3)
2640 require.Len(t, stack[app.methodInt(MethodPost)], 2)
2641 require.Len(t, stack[app.methodInt(MethodPut)], 1)
2642 require.Len(t, stack[app.methodInt(MethodPatch)], 1)
2643 require.Len(t, stack[app.methodInt(MethodDelete)], 1)
2644 require.Len(t, stack[app.methodInt(MethodConnect)], 1)
2645 require.Len(t, stack[app.methodInt(MethodOptions)], 1)
2646 require.Len(t, stack[app.methodInt(MethodTrace)], 1)
2647 require.Len(t, stack[app.methodInt(MethodQuery)], 2)
2648}
2649
2650// go test -run Test_App_HandlersCount
2651func Test_App_HandlersCount(t *testing.T) {

Callers

nothing calls this directly

Calls 9

startupProcessMethod · 0.80
StackMethod · 0.80
methodIntMethod · 0.80
NewFunction · 0.70
UseMethod · 0.65
GetMethod · 0.65
PostMethod · 0.65
QueryMethod · 0.65
LenMethod · 0.65

Tested by

no test coverage detected