Home / Function/ TestRenderYAML() — gin Function Reference

TestRenderYAML() — gin Function Reference

Architecture documentation for the TestRenderYAML() function in render_test.go from the gin codebase.

Entity Profile

Dependency Diagram

graph TD
  d3c836aa_7de9_8c78_c891_c8433e8a963a["TestRenderYAML()"]
  067a4839_481a_7bd8_fc59_5c8c3313879c["render_test.go"]
  d3c836aa_7de9_8c78_c891_c8433e8a963a -->|defined in| 067a4839_481a_7bd8_fc59_5c8c3313879c
  style d3c836aa_7de9_8c78_c891_c8433e8a963a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

render/render_test.go lines 276–298

func TestRenderYAML(t *testing.T) {
	w := httptest.NewRecorder()
	data := `
a : Easy!
b:
	c: 2
	d: [3, 4]
	`
	(YAML{data}).WriteContentType(w)
	assert.Equal(t, "application/yaml; charset=utf-8", w.Header().Get("Content-Type"))

	err := (YAML{data}).Render(w)
	require.NoError(t, err)

	// With github.com/goccy/go-yaml, the output format is different from gopkg.in/yaml.v3
	// We're checking that the output contains the expected data, not the exact formatting
	output := w.Body.String()
	assert.Contains(t, output, "a : Easy!")
	assert.Contains(t, output, "b:")
	assert.Contains(t, output, "c: 2")
	assert.Contains(t, output, "d: [3, 4]")
	assert.Equal(t, "application/yaml; charset=utf-8", w.Header().Get("Content-Type"))
}

Subdomains

Frequently Asked Questions

What does TestRenderYAML() do?
TestRenderYAML() is a function in the gin codebase, defined in render/render_test.go.
Where is TestRenderYAML() defined?
TestRenderYAML() is defined in render/render_test.go at line 276.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free