Home / File/ path_test.go — fiber Source File

path_test.go — fiber Source File

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

File go FiberCore Routing 1 imports 13 functions 4 classes

Entity Profile

Dependency Diagram

graph LR
  3c817cfc_3291_59ba_a2f8_291f66a9b0a1["path_test.go"]
  adf3d4e8_4d86_86c1_e6cc_281d7b4104af["fmt"]
  3c817cfc_3291_59ba_a2f8_291f66a9b0a1 --> adf3d4e8_4d86_86c1_e6cc_281d7b4104af
  style 3c817cfc_3291_59ba_a2f8_291f66a9b0a1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// ⚡️ Fiber is an Express inspired web framework written in Go with ☕️
// 📝 GitHub Repository: https://github.com/gofiber/fiber
// 📌 API Documentation: https://docs.gofiber.io

package fiber

import (
	"fmt"
	"strings"
	"testing"

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

// go test -race -run Test_Path_parseRoute
func Test_Path_parseRoute(t *testing.T) {
	t.Parallel()
	var rp routeParser

	rp = parseRoute("/shop/product/::filter/color::color/size::size")
	require.Equal(t, routeParser{
		segs: []*routeSegment{
			{Const: "/shop/product/:", Length: 15},
			{IsParam: true, ParamName: "filter", ComparePart: "/color:", PartCount: 1},
			{Const: "/color:", Length: 7},
			{IsParam: true, ParamName: "color", ComparePart: "/size:", PartCount: 1},
			{Const: "/size:", Length: 6},
			{IsParam: true, ParamName: "size", IsLast: true},
		},
		params: []string{"filter", "color", "size"},
	}, rp)

	rp = parseRoute("/api/v1/:param/abc/*")
	require.Equal(t, routeParser{
		segs: []*routeSegment{
			{Const: "/api/v1/", Length: 8},
			{IsParam: true, ParamName: "param", ComparePart: "/abc", PartCount: 1},
			{Const: "/abc/", Length: 5, HasOptionalSlash: true},
			{IsParam: true, ParamName: "*1", IsGreedy: true, IsOptional: true, IsLast: true},
		},
		params:        []string{"param", "*1"},
		wildCardCount: 1,
	}, rp)

	rp = parseRoute("/v1/some/resource/name\\:customVerb")
	require.Equal(t, routeParser{
		segs: []*routeSegment{
			{Const: "/v1/some/resource/name:customVerb", Length: 33, IsLast: true},
		},
		params: nil,
	}, rp)

	rp = parseRoute("/v1/some/resource/:name\\:customVerb")
	require.Equal(t, routeParser{
		segs: []*routeSegment{
			{Const: "/v1/some/resource/", Length: 18},
			{IsParam: true, ParamName: "name", ComparePart: ":customVerb", PartCount: 1},
			{Const: ":customVerb", Length: 11, IsLast: true},
		},
		params: []string{"name"},
// ... (405 more lines)

Domain

Subdomains

Types

Dependencies

  • fmt

Frequently Asked Questions

What does path_test.go do?
path_test.go is a source file in the fiber codebase, written in go. It belongs to the FiberCore domain, Routing subdomain.
What functions are defined in path_test.go?
path_test.go defines 13 function(s): Benchmark_Path_matchParams, Benchmark_RoutePatternMatch, Benchmark_Utils_RemoveEscapeChar, TestHasPartialMatchBoundary, Test_App_Register_TooManyParams_Panic, Test_ConstraintCheckConstraint_InvalidMetadata, Test_Path_matchParams, Test_Path_parseRoute, Test_RoutePatternMatch, Test_Route_TooManyParams_Panic, and 3 more.
What does path_test.go depend on?
path_test.go imports 1 module(s): fmt.
Where is path_test.go in the architecture?
path_test.go is located at path_test.go (domain: FiberCore, subdomain: Routing).

Analyze Your Own Codebase

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

Try Supermodel Free