MCPcopy Create free account
hub / github.com/cli/cli / TestUntrusted_String_sanitizes

Function TestUntrusted_String_sanitizes

pkg/iostreams/untrusted_test.go:14–17  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

12const esc = "\x1b"
13
14func TestUntrusted_String_sanitizes(t *testing.T) {
15 u := NewUntrusted("hello" + esc + "[31mRED" + esc + "[0m")
16 assert.NotContains(t, u.String(), esc)
17}
18
19// The property that drove the design: fmt reflection must not leak the raw
20// bytes through any verb. Because Untrusted implements Stringer, %s, %v, and the

Callers

nothing calls this directly

Calls 2

StringMethod · 0.95
NewUntrustedFunction · 0.85

Tested by

no test coverage detected