gin_test.go — gin Source File
Architecture documentation for gin_test.go, a go file in the gin codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 5d6e7276_feeb_b8e2_30e8_0ae0827740a5["gin_test.go"] 42f31d70_aba9_83f2_10b0_38d867c2e467["tls"] 5d6e7276_feeb_b8e2_30e8_0ae0827740a5 --> 42f31d70_aba9_83f2_10b0_38d867c2e467 style 5d6e7276_feeb_b8e2_30e8_0ae0827740a5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
// Copyright 2014 Manu Martinez-Almeida. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package gin
import (
"crypto/tls"
"fmt"
"html/template"
"io"
"net"
"net/http"
"net/http/httptest"
"reflect"
"strconv"
"strings"
"sync/atomic"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"golang.org/x/net/http2"
)
func formatAsDate(t time.Time) string {
year, month, day := t.Date()
return fmt.Sprintf("%d/%02d/%02d", year, month, day)
}
func setupHTMLFiles(t *testing.T, mode string, tls bool, loadMethod func(*Engine)) *httptest.Server {
SetMode(mode)
defer SetMode(TestMode)
var router *Engine
captureOutput(t, func() {
router = New()
router.Delims("{[{", "}]}")
router.SetFuncMap(template.FuncMap{
"formatAsDate": formatAsDate,
})
loadMethod(router)
router.GET("/test", func(c *Context) {
c.HTML(http.StatusOK, "hello.tmpl", map[string]string{"name": "world"})
})
router.GET("/raw", func(c *Context) {
c.HTML(http.StatusOK, "raw.tmpl", map[string]any{
"now": time.Date(2017, 07, 01, 0, 0, 0, 0, time.UTC), //nolint:gofumpt
})
})
})
var ts *httptest.Server
if tls {
ts = httptest.NewTLSServer(router)
} else {
ts = httptest.NewServer(router)
}
// ... (1027 more lines)
Domain
Subdomains
Functions
- TestAddRoute()
- TestAddRouteFails()
- TestCreateDefaultRouter()
- TestCreateEngine()
- TestCustomUnmarshalStruct()
- TestEngineHandleContext()
- TestEngineHandleContextManyReEntries()
- TestEngineHandleContextPreventsMiddlewareReEntry()
- TestEngineHandleContextUseEscapedPathOverride()
- TestEngineHandleContextUseEscapedPathPercentEncoded()
- TestEngineHandleContextUseRawPathPercentEncoded()
- TestH2c()
- TestListOfRoutes()
- TestLiteralColonWithDirectServeHTTP()
- TestLiteralColonWithHTTPServer()
- TestLiteralColonWithHandler()
- TestLiteralColonWithRun()
- TestLoadHTMLFSDebugMode()
- TestLoadHTMLFSFuncMap()
- TestLoadHTMLFSReleaseMode()
- TestLoadHTMLFSTestMode()
- TestLoadHTMLFSUsingTLS()
- TestLoadHTMLFilesDebugMode()
- TestLoadHTMLFilesFuncMap()
- TestLoadHTMLFilesReleaseMode()
- TestLoadHTMLFilesTestMode()
- TestLoadHTMLFilesUsingTLS()
- TestLoadHTMLGlobDebugMode()
- TestLoadHTMLGlobFromFuncMap()
- TestLoadHTMLGlobReleaseMode()
- TestLoadHTMLGlobTestMode()
- TestLoadHTMLGlobUsingTLS()
- TestMethodNotAllowedNoRoute()
- TestNewOptionFunc()
- TestNoMethodWithGlobalHandlers()
- TestNoMethodWithoutGlobalHandlers()
- TestNoRouteWithGlobalHandlers()
- TestNoRouteWithoutGlobalHandlers()
- TestPrepareTrustedCIRDsWith()
- TestRebuild404Handlers()
- TestUpdateRouteTreesCalledOnce()
- TestWithOptionFunc()
- assertRoutePresent()
- compareFunc()
- formatAsDate()
- handlerTest1()
- handlerTest2()
- init()
- parseCIDR()
- setupHTMLFiles()
Types
Dependencies
- tls
Source
Frequently Asked Questions
What does gin_test.go do?
gin_test.go is a source file in the gin codebase, written in go. It belongs to the GinCore domain, Middleware subdomain.
What functions are defined in gin_test.go?
gin_test.go defines 50 function(s): TestAddRoute, TestAddRouteFails, TestCreateDefaultRouter, TestCreateEngine, TestCustomUnmarshalStruct, TestEngineHandleContext, TestEngineHandleContextManyReEntries, TestEngineHandleContextPreventsMiddlewareReEntry, TestEngineHandleContextUseEscapedPathOverride, TestEngineHandleContextUseEscapedPathPercentEncoded, and 40 more.
What does gin_test.go depend on?
gin_test.go imports 1 module(s): tls.
Where is gin_test.go in the architecture?
gin_test.go is located at gin_test.go (domain: GinCore, subdomain: Middleware).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free