mirror of https://github.com/gofiber/fiber.git
🩹Fix render test
parent
32cd3e225f
commit
d1b80af26e
|
@ -0,0 +1 @@
|
|||
<h1>{{.Title}}</h1>
|
|
@ -1396,10 +1396,11 @@ func Test_Ctx_Redirect(t *testing.T) {
|
|||
|
||||
// go test -run Test_Ctx_Render
|
||||
func Test_Ctx_Render(t *testing.T) {
|
||||
t.Parallel()
|
||||
app := New()
|
||||
ctx := app.AcquireCtx(&fasthttp.RequestCtx{})
|
||||
defer app.ReleaseCtx(ctx)
|
||||
err := ctx.Render("./.github/index.tmpl", Map{
|
||||
err := ctx.Render("./.github/single.tmpl", Map{
|
||||
"Title": "Hello, World!",
|
||||
})
|
||||
utils.AssertEqual(t, nil, err)
|
||||
|
@ -1416,14 +1417,13 @@ func (t *testTemplateEngine) Render(w io.Writer, name string, bind interface{},
|
|||
}
|
||||
|
||||
func (t *testTemplateEngine) Load() error {
|
||||
t.mu.Lock()
|
||||
defer t.mu.Unlock()
|
||||
t.templates = template.Must(template.ParseGlob("./.github/*.tmpl"))
|
||||
return nil
|
||||
}
|
||||
|
||||
// go test -run Test_Ctx_Render_Engine
|
||||
func Test_Ctx_Render_Engine(t *testing.T) {
|
||||
t.Parallel()
|
||||
engine := &testTemplateEngine{}
|
||||
engine.Load()
|
||||
app := New()
|
||||
|
|
Loading…
Reference in New Issue