MCPcopy Create free account
hub / github.com/google/pprof / TestRightPad

Function TestRightPad

internal/report/source_test.go:238–258  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

236}
237
238func TestRightPad(t *testing.T) {
239 for _, c := range []struct {
240 pad int
241 in string
242 expect string
243 }{
244 {0, "", ""},
245 {4, "", " "},
246 {4, "x", "x "},
247 {4, "abcd", "abcd"}, // No padding because of overflow
248 {4, "abcde", "abcde"}, // No padding because of overflow
249 {10, "\tx", " x "},
250 {10, "w\txy\tz", "w xy z"},
251 {20, "w\txy\tz", "w xy z "},
252 } {
253 out := rightPad(c.in, c.pad)
254 if out != c.expect {
255 t.Errorf("rightPad(%q, %d): got %q, want %q", c.in, c.pad, out, c.expect)
256 }
257 }
258}
259
260func readProfile(fname string, t *testing.T) *profile.Profile {
261 file, err := os.Open(fname)

Callers

nothing calls this directly

Calls 1

rightPadFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…