MCPcopy
hub / github.com/gin-gonic/gin / TestRenderTOML

Function TestRenderTOML

render/render_test.go:345–358  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

343}
344
345func TestRenderTOML(t *testing.T) {
346 w := httptest.NewRecorder()
347 data := map[string]any{
348 "foo": "bar",
349 "html": "<b>",
350 }
351 (TOML{data}).WriteContentType(w)
352 assert.Equal(t, "application/toml; charset=utf-8", w.Header().Get("Content-Type"))
353
354 err := (TOML{data}).Render(w)
355 require.NoError(t, err)
356 assert.Equal(t, "foo = 'bar'\nhtml = '<b>'\n", w.Body.String())
357 assert.Equal(t, "application/toml; charset=utf-8", w.Header().Get("Content-Type"))
358}
359
360func TestRenderTOMLFail(t *testing.T) {
361 w := httptest.NewRecorder()

Callers

nothing calls this directly

Calls 5

WriteContentTypeMethod · 0.65
RenderMethod · 0.65
StringMethod · 0.65
GetMethod · 0.45
HeaderMethod · 0.45

Tested by

no test coverage detected