Home / File/ gins_test.go — gin Source File

gins_test.go — gin Source File

Architecture documentation for gins_test.go, a go file in the gin codebase. 1 imports, 0 dependents.

File go StaticWrappers SingletonEngine 1 imports 19 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  79139b72_4aa3_e743_29b2_537065ba4bec["gins_test.go"]
  6b9ad13d_c776_a5f8_e8c7_1816de72cb86["template"]
  79139b72_4aa3_e743_29b2_537065ba4bec --> 6b9ad13d_c776_a5f8_e8c7_1816de72cb86
  style 79139b72_4aa3_e743_29b2_537065ba4bec fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// Copyright 2025 Gin Core Team. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.

package ginS

import (
	"html/template"
	"net/http"
	"net/http/httptest"
	"testing"

	"github.com/gin-gonic/gin"
	"github.com/stretchr/testify/assert"
)

func init() {
	gin.SetMode(gin.TestMode)
}

func TestGET(t *testing.T) {
	GET("/test", func(c *gin.Context) {
		c.String(http.StatusOK, "test")
	})

	req := httptest.NewRequest(http.MethodGet, "/test", nil)
	w := httptest.NewRecorder()
	engine().ServeHTTP(w, req)

	assert.Equal(t, http.StatusOK, w.Code)
	assert.Equal(t, "test", w.Body.String())
}

func TestPOST(t *testing.T) {
	POST("/post", func(c *gin.Context) {
		c.String(http.StatusCreated, "created")
	})

	req := httptest.NewRequest(http.MethodPost, "/post", nil)
	w := httptest.NewRecorder()
	engine().ServeHTTP(w, req)

	assert.Equal(t, http.StatusCreated, w.Code)
	assert.Equal(t, "created", w.Body.String())
}

func TestPUT(t *testing.T) {
	PUT("/put", func(c *gin.Context) {
		c.String(http.StatusOK, "updated")
	})

	req := httptest.NewRequest(http.MethodPut, "/put", nil)
	w := httptest.NewRecorder()
	engine().ServeHTTP(w, req)

	assert.Equal(t, http.StatusOK, w.Code)
	assert.Equal(t, "updated", w.Body.String())
}

func TestDELETE(t *testing.T) {
// ... (187 more lines)

Subdomains

Dependencies

  • template

Frequently Asked Questions

What does gins_test.go do?
gins_test.go is a source file in the gin codebase, written in go. It belongs to the StaticWrappers domain, SingletonEngine subdomain.
What functions are defined in gins_test.go?
gins_test.go defines 19 function(s): TestAny, TestDELETE, TestGET, TestGroup, TestHEAD, TestHandle, TestNoMethod, TestNoRoute, TestOPTIONS, TestPATCH, and 9 more.
What does gins_test.go depend on?
gins_test.go imports 1 module(s): template.
Where is gins_test.go in the architecture?
gins_test.go is located at ginS/gins_test.go (domain: StaticWrappers, subdomain: SingletonEngine, directory: ginS).

Analyze Your Own Codebase

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

Try Supermodel Free