debug_test.go — gin Source File
Architecture documentation for debug_test.go, a go file in the gin codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 93aa143e_ba29_95e3_6171_a922a9c84ca0["debug_test.go"] 285f3da5_b453_bac8_eb53_efea9feb6bb9["errors"] 93aa143e_ba29_95e3_6171_a922a9c84ca0 --> 285f3da5_b453_bac8_eb53_efea9feb6bb9 style 93aa143e_ba29_95e3_6171_a922a9c84ca0 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 (
"errors"
"fmt"
"html/template"
"io"
"log"
"net/http"
"os"
"strings"
"sync"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestIsDebugging(t *testing.T) {
SetMode(DebugMode)
assert.True(t, IsDebugging())
SetMode(ReleaseMode)
assert.False(t, IsDebugging())
SetMode(TestMode)
assert.False(t, IsDebugging())
}
func TestDebugPrint(t *testing.T) {
re := captureOutput(t, func() {
SetMode(DebugMode)
SetMode(ReleaseMode)
debugPrint("DEBUG this!")
SetMode(TestMode)
debugPrint("DEBUG this!")
SetMode(DebugMode)
debugPrint("these are %d %s", 2, "error messages")
SetMode(TestMode)
})
assert.Equal(t, "[GIN-debug] these are 2 error messages\n", re)
}
func TestDebugPrintFunc(t *testing.T) {
DebugPrintFunc = func(format string, values ...any) {
fmt.Fprintf(DefaultWriter, "[GIN-debug] "+format, values...)
}
re := captureOutput(t, func() {
SetMode(DebugMode)
debugPrint("debug print func test: %d", 123)
SetMode(TestMode)
})
assert.Regexp(t, `^\[GIN-debug\] debug print func test: 123`, re)
}
func TestDebugPrintError(t *testing.T) {
re := captureOutput(t, func() {
SetMode(DebugMode)
// ... (121 more lines)
Domain
Subdomains
Functions
- TestDebugPrint()
- TestDebugPrintError()
- TestDebugPrintFunc()
- TestDebugPrintLoadTemplate()
- TestDebugPrintRouteFunc()
- TestDebugPrintRoutes()
- TestDebugPrintWARNINGDefault()
- TestDebugPrintWARNINGDefaultWithUnsupportedVersion()
- TestDebugPrintWARNINGNew()
- TestDebugPrintWARNINGSetHTMLTemplate()
- TestGetMinVer()
- TestIsDebugging()
- captureOutput()
Classes
Dependencies
- errors
Source
Frequently Asked Questions
What does debug_test.go do?
debug_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 debug_test.go?
debug_test.go defines 13 function(s): TestDebugPrint, TestDebugPrintError, TestDebugPrintFunc, TestDebugPrintLoadTemplate, TestDebugPrintRouteFunc, TestDebugPrintRoutes, TestDebugPrintWARNINGDefault, TestDebugPrintWARNINGDefaultWithUnsupportedVersion, TestDebugPrintWARNINGNew, TestDebugPrintWARNINGSetHTMLTemplate, and 3 more.
What does debug_test.go depend on?
debug_test.go imports 1 module(s): errors.
Where is debug_test.go in the architecture?
debug_test.go is located at debug_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