Test_Utils_GetSplicedStrList() — fiber Function Reference
Architecture documentation for the Test_Utils_GetSplicedStrList() function in helpers_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD 253f679c_a0c9_88b1_fe5a_45ca11e07480["Test_Utils_GetSplicedStrList()"] c82e3595_b1b8_f596_c097_f26fa40159d1["helpers_test.go"] 253f679c_a0c9_88b1_fe5a_45ca11e07480 -->|defined in| c82e3595_b1b8_f596_c097_f26fa40159d1 style 253f679c_a0c9_88b1_fe5a_45ca11e07480 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
helpers_test.go lines 455–523
func Test_Utils_GetSplicedStrList(t *testing.T) {
t.Parallel()
testCases := []struct {
description string
headerValue string
expectedList []string
}{
{
description: "normal case",
headerValue: "gzip, deflate,br",
expectedList: []string{"gzip", "deflate", "br"},
},
{
description: "no matter the value",
headerValue: " gzip,deflate, br, zip",
expectedList: []string{"gzip", "deflate", "br", "zip"},
},
{
description: "comma with trailing spaces around values",
headerValue: "gzip , br",
expectedList: []string{"gzip", "br"},
},
{
description: "comma with tabbed whitespace",
headerValue: "gzip\t,br",
expectedList: []string{"gzip", "br"},
},
{
description: "headerValue is empty",
headerValue: "",
expectedList: nil,
},
{
description: "has a comma without element",
headerValue: "gzip,",
expectedList: []string{"gzip", ""},
},
{
description: "has a space between words",
headerValue: " foo bar, hello world",
expectedList: []string{"foo bar", "hello world"},
},
{
description: "single comma",
headerValue: ",",
expectedList: []string{"", ""},
},
{
description: "multiple comma",
headerValue: ",,",
expectedList: []string{"", "", ""},
},
{
description: "comma with space",
headerValue: ", ,",
expectedList: []string{"", "", ""},
},
}
for _, tc := range testCases {
t.Run(tc.description, func(t *testing.T) {
tc := tc // create a new 'tc' variable for the goroutine
t.Parallel()
dst := make([]string, 10)
result := getSplicedStrList(tc.headerValue, dst)
require.Equal(t, tc.expectedList, result)
})
}
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does Test_Utils_GetSplicedStrList() do?
Test_Utils_GetSplicedStrList() is a function in the fiber codebase, defined in helpers_test.go.
Where is Test_Utils_GetSplicedStrList() defined?
Test_Utils_GetSplicedStrList() is defined in helpers_test.go at line 455.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free