Home / Function/ TestColorForStatus() — gin Function Reference

TestColorForStatus() — gin Function Reference

Architecture documentation for the TestColorForStatus() function in logger_test.go from the gin codebase.

Entity Profile

Dependency Diagram

graph TD
  f4f63af2_2f98_d8c7_f2b4_102239288f2e["TestColorForStatus()"]
  9089ba1c_3991_2941_2a87_9934a9e12a6a["logger_test.go"]
  f4f63af2_2f98_d8c7_f2b4_102239288f2e -->|defined in| 9089ba1c_3991_2941_2a87_9934a9e12a6a
  style f4f63af2_2f98_d8c7_f2b4_102239288f2e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

logger_test.go lines 305–318

func TestColorForStatus(t *testing.T) {
	colorForStatus := func(code int) string {
		p := LogFormatterParams{
			StatusCode: code,
		}
		return p.StatusCodeColor()
	}

	assert.Equal(t, white, colorForStatus(http.StatusContinue), "1xx should be white")
	assert.Equal(t, green, colorForStatus(http.StatusOK), "2xx should be green")
	assert.Equal(t, white, colorForStatus(http.StatusMovedPermanently), "3xx should be white")
	assert.Equal(t, yellow, colorForStatus(http.StatusNotFound), "4xx should be yellow")
	assert.Equal(t, red, colorForStatus(2), "other things should be red")
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does TestColorForStatus() do?
TestColorForStatus() is a function in the gin codebase, defined in logger_test.go.
Where is TestColorForStatus() defined?
TestColorForStatus() is defined in logger_test.go at line 305.

Analyze Your Own Codebase

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

Try Supermodel Free