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

Function TestDocURL

internal/report/report_test.go:554–581  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

552}
553
554func TestDocURL(t *testing.T) {
555 type testCase struct {
556 input string
557 want string
558 }
559 for name, c := range map[string]testCase{
560 "empty": {"", ""},
561 "http": {"http://example.com/pprof-help", "http://example.com/pprof-help"},
562 "https": {"https://example.com/pprof-help", "https://example.com/pprof-help"},
563 "relative": {"/foo", ""},
564 "nonhttp": {"mailto:nobody@example.com", ""},
565 } {
566 t.Run(name, func(t *testing.T) {
567 profile := testProfile.Copy()
568 profile.DocURL = c.input
569 rpt := New(profile, &Options{
570 OutputFormat: Dot,
571 Symbol: regexp.MustCompile(`.`),
572 TrimPath: "/some/path",
573 SampleValue: func(v []int64) int64 { return v[1] },
574 SampleUnit: testProfile.SampleType[1].Unit,
575 })
576 if got := rpt.DocURL(); got != c.want {
577 t.Errorf("bad doc URL %q, expecting %q", got, c.want)
578 }
579 })
580 }
581}
582
583func TestDocURLInLabels(t *testing.T) {
584 const url = "http://example.com/pprof-help"

Callers

nothing calls this directly

Calls 3

CopyMethod · 0.80
DocURLMethod · 0.80
NewFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…