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

Function TestShortenFunctionName

internal/graph/graph_test.go:422–547  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

420}
421
422func TestShortenFunctionName(t *testing.T) {
423 type testCase struct {
424 name string
425 want string
426 }
427 testcases := []testCase{
428 {
429 "root",
430 "root",
431 },
432 {
433 "syscall.Syscall",
434 "syscall.Syscall",
435 },
436 {
437 "net/http.(*conn).serve",
438 "http.(*conn).serve",
439 },
440 {
441 "github.com/blahBlah/foo.Foo",
442 "foo.Foo",
443 },
444 {
445 "github.com/BlahBlah/foo.Foo",
446 "foo.Foo",
447 },
448 {
449 "github.com/BlahBlah/foo.Foo[...]",
450 "foo.Foo[...]",
451 },
452 {
453 "github.com/blah-blah/foo_bar.(*FooBar).Foo",
454 "foo_bar.(*FooBar).Foo",
455 },
456 {
457 "encoding/json.(*structEncoder).(encoding/json.encode)-fm",
458 "json.(*structEncoder).(encoding/json.encode)-fm",
459 },
460 {
461 "github.com/blah/blah/vendor/gopkg.in/redis.v3.(*baseClient).(github.com/blah/blah/vendor/gopkg.in/redis.v3.process)-fm",
462 "redis.v3.(*baseClient).(github.com/blah/blah/vendor/gopkg.in/redis.v3.process)-fm",
463 },
464 {
465 "github.com/foo/bar/v4.(*Foo).Bar",
466 "bar.(*Foo).Bar",
467 },
468 {
469 "github.com/foo/bar/v4/baz.Foo.Bar",
470 "baz.Foo.Bar",
471 },
472 {
473 "github.com/foo/bar/v123.(*Foo).Bar",
474 "bar.(*Foo).Bar",
475 },
476 {
477 "github.com/foobar/v0.(*Foo).Bar",
478 "v0.(*Foo).Bar",
479 },

Callers

nothing calls this directly

Calls 1

ShortenFunctionNameFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…