Home / Function/ TestRenderAsciiJSON() — gin Function Reference

TestRenderAsciiJSON() — gin Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

render/render_test.go lines 211–230

func TestRenderAsciiJSON(t *testing.T) {
	w1 := httptest.NewRecorder()
	data1 := map[string]any{
		"lang": "GO语言",
		"tag":  "<br>",
	}

	err := (AsciiJSON{data1}).Render(w1)

	require.NoError(t, err)
	assert.JSONEq(t, "{\"lang\":\"GO\\u8bed\\u8a00\",\"tag\":\"\\u003cbr\\u003e\"}", w1.Body.String())
	assert.Equal(t, "application/json", w1.Header().Get("Content-Type"))

	w2 := httptest.NewRecorder()
	data2 := 3.1415926

	err = (AsciiJSON{data2}).Render(w2)
	require.NoError(t, err)
	assert.Equal(t, "3.1415926", w2.Body.String())
}

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free