MCPcopy Index your code
hub / github.com/jetify-com/devbox / TestErrorf

Function TestErrorf

internal/redact/redact_test.go:135–145  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

133}
134
135func TestErrorf(t *testing.T) {
136 err := Errorf("quoted = %q, quotedSafe = %q, int = %d, intSafe = %d",
137 "sensitive", Safe("safe"),
138 123, Safe(789),
139 )
140 checkUnredactedError(t, err, `quoted = "sensitive", quotedSafe = "safe", int = 123, intSafe = 789`)
141 checkRedactedError(t, err, `quoted = <redacted string>, quotedSafe = "safe", int = <redacted int>, intSafe = 789`)
142
143 // Redact again to check that we don't wipe out the already-redacted message.
144 checkRedactedError(t, Error(err), `quoted = <redacted string>, quotedSafe = "safe", int = <redacted int>, intSafe = 789`)
145}
146
147func TestErrorfWrapErrorf(t *testing.T) {
148 wrapped := Errorf("wrapped string = %s, wrapped safe string = %s", "sensitive", Safe("safe"))

Callers

nothing calls this directly

Calls 5

ErrorfFunction · 0.85
SafeFunction · 0.85
checkUnredactedErrorFunction · 0.85
checkRedactedErrorFunction · 0.85
ErrorFunction · 0.70

Tested by

no test coverage detected