TestGetSrcBranchURL also tests pkgURL and srcURL and symbol.
(t *testing.T)
| 80 | |
| 81 | // TestGetSrcBranchURL also tests pkgURL and srcURL and symbol. |
| 82 | func TestGetSrcBranchURL(t *testing.T) { |
| 83 | t.Parallel() |
| 84 | ver := runtime.Version() |
| 85 | const prefix = "devel +" |
| 86 | if strings.HasPrefix(ver, prefix) { |
| 87 | ver = ver[len(prefix) : len(prefix)+10] |
| 88 | } |
| 89 | ver = url.QueryEscape(ver) |
| 90 | data := []struct { |
| 91 | name string |
| 92 | c Call |
| 93 | url, branch template.URL |
| 94 | pkgURL template.URL |
| 95 | loc Location |
| 96 | }{ |
| 97 | { |
| 98 | "stdlib", |
| 99 | newCallLocal( |
| 100 | "net/http.(*Server).Serve", |
| 101 | Args{}, |
| 102 | goroot+"/src/net/http/server.go", |
| 103 | 2933), |
| 104 | template.URL("https://github.com/golang/go/blob/" + ver + "/src/net/http/server.go#L2933"), |
| 105 | template.URL(ver), |
| 106 | "https://golang.org/pkg/net/http#Server.Serve", |
| 107 | Stdlib, |
| 108 | }, |
| 109 | { |
| 110 | "gomodref", |
| 111 | newCallLocal( |
| 112 | "github.com/mattn/go-colorable.(*NonColorable).Write", |
| 113 | Args{}, |
| 114 | gopath+"/pkg/mod/github.com/mattn/go-colorable@v0.1.6/noncolorable.go", |
| 115 | 30), |
| 116 | "https://github.com/mattn/go-colorable/blob/v0.1.6/noncolorable.go#L30", |
| 117 | "v0.1.6", |
| 118 | "https://pkg.go.dev/github.com/mattn/go-colorable@v0.1.6#NonColorable.Write", |
| 119 | GoPkg, |
| 120 | }, |
| 121 | /* TODO(maruel): Fix this. |
| 122 | { |
| 123 | "gomodref_with_dot", |
| 124 | newCallLocal( |
| 125 | "gopkg.in/fsnotify%2ev1.NewWatcher", |
| 126 | Args{}, |
| 127 | gopath+"/pkg/mod/gopkg.in/fsnotify.v1@v1.4.7/inotify.go", |
| 128 | 59), |
| 129 | "file:////home/user/go/pkg/mod/gopkg.in/fsnotify.v1@v1.4.7/inotify.go", |
| 130 | "v1.4.7", |
| 131 | "https://pkg.go.dev/gopkg.in/fsnotify.v1@v1.4.7#NewWatcher", |
| 132 | GoPkg, |
| 133 | }, |
| 134 | */ |
| 135 | { |
| 136 | "gomod_commit_ref", |
| 137 | newCallLocal( |
| 138 | "golang.org/x/sys/unix.Nanosleep", |
| 139 | Args{}, |
nothing calls this directly
no test coverage detected
searching dependent graphs…