MCPcopy Index your code
hub / github.com/pkg/errors / TestFormatWrapf

Function TestFormatWrapf

format_test.go:120–159  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

118}
119
120func TestFormatWrapf(t *testing.T) {
121 tests := []struct {
122 error
123 format string
124 want string
125 }{{
126 Wrapf(io.EOF, "error%d", 2),
127 "%s",
128 "error2: EOF",
129 }, {
130 Wrapf(io.EOF, "error%d", 2),
131 "%v",
132 "error2: EOF",
133 }, {
134 Wrapf(io.EOF, "error%d", 2),
135 "%+v",
136 "EOF\n" +
137 "error2\n" +
138 "github.com/pkg/errors.TestFormatWrapf\n" +
139 "\t.+/github.com/pkg/errors/format_test.go:134",
140 }, {
141 Wrapf(New("error"), "error%d", 2),
142 "%s",
143 "error2: error",
144 }, {
145 Wrapf(New("error"), "error%d", 2),
146 "%v",
147 "error2: error",
148 }, {
149 Wrapf(New("error"), "error%d", 2),
150 "%+v",
151 "error\n" +
152 "github.com/pkg/errors.TestFormatWrapf\n" +
153 "\t.+/github.com/pkg/errors/format_test.go:149",
154 }}
155
156 for i, tt := range tests {
157 testFormatRegexp(t, i, tt.error, tt.format, tt.want)
158 }
159}
160
161func TestFormatWithStack(t *testing.T) {
162 tests := []struct {

Callers

nothing calls this directly

Calls 3

WrapfFunction · 0.85
NewFunction · 0.85
testFormatRegexpFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…