Test_NewErrorf_Format() — fiber Function Reference
Architecture documentation for the Test_NewErrorf_Format() function in app_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD a65f1caa_7d5c_6753_8138_8bb86b89c0c3["Test_NewErrorf_Format()"] e728fdd2_242f_706b_c1d2_041b3d6badb5["app_test.go"] a65f1caa_7d5c_6753_8138_8bb86b89c0c3 -->|defined in| e728fdd2_242f_706b_c1d2_041b3d6badb5 style a65f1caa_7d5c_6753_8138_8bb86b89c0c3 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
app_test.go lines 1902–1965
func Test_NewErrorf_Format(t *testing.T) {
t.Parallel()
type args []any
tests := []struct {
name string
want string
in args
code int
}{
{
name: "no-args → default text",
code: StatusNotFound,
in: nil,
want: utils.StatusMessage(StatusNotFound),
},
{
name: "single-string arg overrides",
code: StatusBadRequest,
in: args{"custom bad request"},
want: "custom bad request",
},
{
name: "single non-string arg stringified",
code: StatusInternalServerError,
in: args{errors.New("db down")},
want: "db down",
},
{
name: "single nil interface",
code: StatusInternalServerError,
in: args{any(nil)},
want: "<nil>",
},
{
name: "format string + args",
code: StatusBadRequest,
in: args{"invalid id %d", 10},
want: "invalid id 10",
},
{
name: "format string + excess args",
code: StatusBadRequest,
in: args{"odd %d", 1, 2, 3},
want: "odd 1%!(EXTRA int=2, int=3)",
},
{
name: "≥2 args but first not string",
code: StatusBadRequest,
in: args{errors.New("boom"), 42},
want: "boom",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
e := NewErrorf(tt.code, tt.in...)
require.Equal(t, tt.code, e.Code)
require.Equal(t, tt.want, e.Message)
})
}
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does Test_NewErrorf_Format() do?
Test_NewErrorf_Format() is a function in the fiber codebase, defined in app_test.go.
Where is Test_NewErrorf_Format() defined?
Test_NewErrorf_Format() is defined in app_test.go at line 1902.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free