MCPcopy Index your code
hub / github.com/cockroachdb/errors / failWithf

Method failWithf

testutils/simplecheck.go:181–203  ·  view source on GitHub ↗
(failTest bool, format string, args ...interface{})

Source from the content-addressed store, hash-verified

179}
180
181func (t *T) failWithf(failTest bool, format string, args ...interface{}) {
182 t.Helper()
183 _, file, line, _ := runtime.Caller(2)
184 var msg bytes.Buffer
185 fmt.Fprintf(&msg, format, args...)
186 contextLines, lineIdx := fileContext(file, line, 1)
187 if len(contextLines) > 0 {
188 msg.WriteString("\ncontext:\n")
189 for i, line := range contextLines {
190 switch {
191 case i == lineIdx:
192 fmt.Fprintf(&msg, "> %s\n", line)
193 default:
194 fmt.Fprintf(&msg, " %s\n", line)
195 }
196 }
197 }
198 if failTest {
199 t.Fatal(msg.String())
200 } else {
201 t.Error(msg.String())
202 }
203}
204
205// The following code is copied from github.com/getsentry/raven-go.
206

Callers 9

AssertMethod · 0.95
AssertEqualMethod · 0.95
AssertDeepEqualMethod · 0.95
CheckMethod · 0.95
CheckEqualMethod · 0.95
CheckContainsMethod · 0.95
CheckStringEqualMethod · 0.95
CheckDeepEqualMethod · 0.95
CheckRegexpEqualMethod · 0.95

Calls 3

fileContextFunction · 0.85
StringMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected