Skip to content

Commit

Permalink
Test and fix multi-version case
Browse files Browse the repository at this point in the history
  • Loading branch information
zikaeroh committed Oct 16, 2020
1 parent 5ca898f commit b05cf5f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/graph/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var (
// See tests for examples.
goRegExp = regexp.MustCompile(`^(?:[\w\-\.]+\/)+(.+)`)
// Removes potential module versions in a package path.
goVerRegExp = regexp.MustCompile(`^(.*)/v(?:[2-9]|[1-9][0-9]+)([./].*)$`)
goVerRegExp = regexp.MustCompile(`^(.*?)/v(?:[2-9]|[1-9][0-9]+)([./].*)$`)
// Strips C++ namespace prefix from a C++ function / method name.
// NOTE: Make sure to keep the template parameters in the name. Normally,
// template parameters are stripped from the C++ names but when
Expand Down
8 changes: 8 additions & 0 deletions internal/graph/graph_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,14 @@ func TestShortenFunctionName(t *testing.T) {
"example.org/v2xyz.Foo",
"v2xyz.Foo",
},
{
"github.com/foo/bar/v4/v4.(*Foo).Bar",
"v4.(*Foo).Bar",
},
{
"github.com/foo/bar/v4/foo/bar/v4.(*Foo).Bar",
"v4.(*Foo).Bar",
},
{
"java.util.concurrent.ThreadPoolExecutor$Worker.run",
"ThreadPoolExecutor$Worker.run",
Expand Down

0 comments on commit b05cf5f

Please sign in to comment.