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

Function Test_Ctx_Render_Engine

ctx_test.go:8054–8067  ·  view source on GitHub ↗

go test -run Test_Ctx_Render_Engine

(t *testing.T)

Source from the content-addressed store, hash-verified

8052
8053// go test -run Test_Ctx_Render_Engine
8054func Test_Ctx_Render_Engine(t *testing.T) {
8055 t.Parallel()
8056 engine := &testTemplateEngine{}
8057 require.NoError(t, engine.Load())
8058 app := New()
8059 app.config.Views = engine
8060 c := app.AcquireCtx(&fasthttp.RequestCtx{})
8061
8062 err := c.Render("index.tmpl", Map{
8063 "Title": "Hello, World!",
8064 })
8065 require.NoError(t, err)
8066 require.Equal(t, "<h1>Hello, World!</h1>", string(c.Response().Body()))
8067}
8068
8069// go test -run Test_Ctx_Render_Engine_With_View_Layout
8070func Test_Ctx_Render_Engine_With_View_Layout(t *testing.T) {

Callers

nothing calls this directly

Calls 6

LoadMethod · 0.95
AcquireCtxMethod · 0.80
NewFunction · 0.70
RenderMethod · 0.65
BodyMethod · 0.65
ResponseMethod · 0.65

Tested by

no test coverage detected