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

Function TestRunEmpty

gin_integration_test.go:66–80  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

64}
65
66func TestRunEmpty(t *testing.T) {
67 os.Setenv("PORT", "")
68 router := New()
69 go func() {
70 router.GET("/example", func(c *Context) { c.String(http.StatusOK, "it worked") })
71 assert.NoError(t, router.Run())
72 }()
73
74 // Wait for server to be ready with exponential backoff
75 err := waitForServerReady("http://localhost:8080/example", 10)
76 require.NoError(t, err, "server should start successfully")
77
78 require.Error(t, router.Run(":8080"))
79 testRequest(t, "http://localhost:8080/example")
80}
81
82func TestBadTrustedCIDRs(t *testing.T) {
83 router := New()

Callers

nothing calls this directly

Calls 7

NewFunction · 0.85
waitForServerReadyFunction · 0.85
testRequestFunction · 0.85
RunMethod · 0.80
GETMethod · 0.65
StringMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected