Home / File/ path_test.go — gin Source File

path_test.go — gin Source File

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

File go GinCore Routing 1 imports 7 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  b533967c_d510_b36e_3d17_b3b896fbdfe2["path_test.go"]
  cdf56a64_632a_00cc_05c0_7b6ba0f92ba2["runtime"]
  b533967c_d510_b36e_3d17_b3b896fbdfe2 --> cdf56a64_632a_00cc_05c0_7b6ba0f92ba2
  style b533967c_d510_b36e_3d17_b3b896fbdfe2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// Copyright 2013 Julien Schmidt. All rights reserved.
// Based on the path package, Copyright 2009 The Go Authors.
// Use of this source code is governed by a BSD-style license that can be found
// at https://github.com/julienschmidt/httprouter/blob/master/LICENSE

package gin

import (
	"runtime"
	"strings"
	"testing"

	"github.com/stretchr/testify/assert"
)

type cleanPathTest struct {
	path, result string
}

var cleanTests = []cleanPathTest{
	// Already clean
	{"/", "/"},
	{"/abc", "/abc"},
	{"/a/b/c", "/a/b/c"},
	{"/abc/", "/abc/"},
	{"/a/b/c/", "/a/b/c/"},

	// missing root
	{"", "/"},
	{"a/", "/a/"},
	{"abc", "/abc"},
	{"abc/def", "/abc/def"},
	{"a/b/c", "/a/b/c"},

	// Remove doubled slash
	{"//", "/"},
	{"/abc//", "/abc/"},
	{"/abc/def//", "/abc/def/"},
	{"/a/b/c//", "/a/b/c/"},
	{"/abc//def//ghi", "/abc/def/ghi"},
	{"//abc", "/abc"},
	{"///abc", "/abc"},
	{"//abc//", "/abc/"},

	// Remove . elements
	{".", "/"},
	{"./", "/"},
	{"/abc/./def", "/abc/def"},
	{"/./abc/def", "/abc/def"},
	{"/abc/.", "/abc/"},

	// Remove .. elements
	{"..", "/"},
	{"../", "/"},
	{"../../", "/"},
	{"../..", "/"},
	{"../../abc", "/abc"},
	{"/abc/def/ghi/../jkl", "/abc/def/jkl"},
	{"/abc/def/../ghi/../jkl", "/abc/jkl"},
	{"/abc/def/..", "/abc"},
// ... (133 more lines)

Domain

Subdomains

Classes

Dependencies

  • runtime

Frequently Asked Questions

What does path_test.go do?
path_test.go is a source file in the gin codebase, written in go. It belongs to the GinCore domain, Routing subdomain.
What functions are defined in path_test.go?
path_test.go defines 7 function(s): BenchmarkPathClean, BenchmarkPathCleanLong, TestPathClean, TestPathCleanLong, TestPathCleanMallocs, TestRemoveRepeatedChar, genLongPaths.
What does path_test.go depend on?
path_test.go imports 1 module(s): runtime.
Where is path_test.go in the architecture?
path_test.go is located at path_test.go (domain: GinCore, subdomain: Routing).

Analyze Your Own Codebase

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

Try Supermodel Free