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

Method CheckStringEqual

testutils/simplecheck.go:138–156  ·  view source on GitHub ↗

CheckEqual checks that the string value is equal to some reference.

(val, ref string)

Source from the content-addressed store, hash-verified

136
137// CheckEqual checks that the string value is equal to some reference.
138func (t *T) CheckStringEqual(val, ref string) {
139 t.Helper()
140 if val != ref {
141 pat := regexp.QuoteMeta(ref)
142 pat = strings.ReplaceAll(pat, "\n", `\n`)
143 pat = strings.ReplaceAll(pat, "'", `'"'"'`)
144 pat = strings.ReplaceAll(pat, "\t", `\t`)
145 repl := strings.ReplaceAll(val, "\n", `\n`)
146 repl = strings.ReplaceAll(repl, "'", `'"'"'`)
147 repl = strings.ReplaceAll(repl, "\t", `\t`)
148 _, file, _, _ := runtime.Caller(1)
149 t.failWithf(false, "values not equal; got:\n %s\nexpected:\n %s\nTo update expected, run:\n perl -0777 -pi -ne 's@%s@%s@ms' %s",
150 strings.ReplaceAll(val, "\n", "\n "),
151 strings.ReplaceAll(ref, "\n", "\n "),
152 pat, repl, file,
153 )
154
155 }
156}
157
158// CheckDeepEqual checks that the value is equal to some reference.
159func (t *T) CheckDeepEqual(val, ref interface{}) {

Callers 15

TestWithContextFunction · 0.95
TestFormatFunction · 0.95
TestHandledWithMessagefFunction · 0.95
TestFormatFunction · 0.95
TestFormatFunction · 0.95
TestRedactFunction · 0.95
TestDetailCaptureFunction · 0.95
TestFormatFunction · 0.95
TestFormatFunction · 0.95
TestIssueLinkFunction · 0.95
TestFormatFunction · 0.95
TestFormatUnimpFunction · 0.95

Calls 1

failWithfMethod · 0.95

Tested by 15

TestWithContextFunction · 0.76
TestFormatFunction · 0.76
TestHandledWithMessagefFunction · 0.76
TestFormatFunction · 0.76
TestFormatFunction · 0.76
TestRedactFunction · 0.76
TestDetailCaptureFunction · 0.76
TestFormatFunction · 0.76
TestFormatFunction · 0.76
TestIssueLinkFunction · 0.76
TestFormatFunction · 0.76
TestFormatUnimpFunction · 0.76