init() — fiber Function Reference
Architecture documentation for the init() function in path_testcases_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD 6473c6f9_a197_1c18_4ec0_5fba12bdc765["init()"] 34200c76_52e1_3c03_c6c1_99f6fe1dce83["path_testcases_test.go"] 6473c6f9_a197_1c18_4ec0_5fba12bdc765 -->|defined in| 34200c76_52e1_3c03_c6c1_99f6fe1dce83 style 6473c6f9_a197_1c18_4ec0_5fba12bdc765 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
path_testcases_test.go lines 28–762
func init() {
// smaller list for benchmark cases
benchmarkCases = []routeCaseCollection{
{
pattern: "/api/v1/const",
testCases: []routeTestCase{
{url: "/api/v1/const", params: []string{}, match: true},
{url: "/api/v1", params: nil, match: false},
{url: "/api/v1/", params: nil, match: false},
{url: "/api/v1/something", params: nil, match: false},
},
},
{
pattern: "/api/:param/fixedEnd",
testCases: []routeTestCase{
{url: "/api/abc/fixedEnd", params: []string{"abc"}, match: true},
{url: "/api/abc/def/fixedEnd", params: nil, match: false},
},
},
{
pattern: "/api/v1/:param/*",
testCases: []routeTestCase{
{url: "/api/v1/entity", params: []string{"entity", ""}, match: true},
{url: "/api/v1/entity/", params: []string{"entity", ""}, match: true},
{url: "/api/v1/entity/1", params: []string{"entity", "1"}, match: true},
{url: "/api/v", params: nil, match: false},
{url: "/api/v2", params: nil, match: false},
{url: "/api/v1/", params: nil, match: false},
},
},
}
// combine benchmark cases and other cases
routeTestCases = benchmarkCases
routeTestCases = append(
routeTestCases,
[]routeCaseCollection{
{
pattern: "/api/v1/:param/+",
testCases: []routeTestCase{
{url: "/api/v1/entity", params: nil, match: false},
{url: "/api/v1/entity/", params: nil, match: false},
{url: "/api/v1/entity/1", params: []string{"entity", "1"}, match: true},
{url: "/api/v", params: nil, match: false},
{url: "/api/v2", params: nil, match: false},
{url: "/api/v1/", params: nil, match: false},
},
},
{
pattern: "/api/v1/:param?",
testCases: []routeTestCase{
{url: "/api/v1", params: []string{""}, match: true},
{url: "/api/v1/", params: []string{""}, match: true},
{url: "/api/v1/optional", params: []string{"optional"}, match: true},
{url: "/api/v", params: nil, match: false},
{url: "/api/v2", params: nil, match: false},
{url: "/api/xyz", params: nil, match: false},
},
},
{
pattern: `/v1/some/resource/name\:customVerb`,
testCases: []routeTestCase{
{url: "/v1/some/resource/name:customVerb", params: nil, match: true},
{url: "/v1/some/resource/name:test", params: nil, match: false},
},
},
{
pattern: `/v1/some/resource/:name\:customVerb`,
testCases: []routeTestCase{
{url: "/v1/some/resource/test:customVerb", params: []string{"test"}, match: true},
{url: "/v1/some/resource/test:test", params: nil, match: false},
},
},
{
pattern: `/v1/some/resource/name\\:customVerb?\?/:param/*`,
testCases: []routeTestCase{
{url: "/v1/some/resource/name:customVerb??/test/optionalWildCard/character", params: []string{"test", "optionalWildCard/character"}, match: true},
{url: "/v1/some/resource/name:customVerb??/test", params: []string{"test", ""}, match: true},
},
},
{
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does init() do?
init() is a function in the fiber codebase, defined in path_testcases_test.go.
Where is init() defined?
init() is defined in path_testcases_test.go at line 28.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free