/usr/share/gocode/src/github.com/constabulary/gb/internal/vendor/repo_test.go is in golang-github-constabulary-gb-dev 0.4.4-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | package vendor
import (
"fmt"
"reflect"
"testing"
)
func TestDeduceRemoteRepo(t *testing.T) {
if testing.Short() {
t.Skipf("skipping network tests in -short mode")
}
tests := []struct {
path string
want RemoteRepo
extra string
err error
insecure bool
}{{
path: "",
err: fmt.Errorf(`"" is not a valid import path`),
}, {
path: "corporate",
err: fmt.Errorf(`"corporate" is not a valid import path`),
}, {
path: "github.com/cznic/b",
want: &gitrepo{
url: "https://github.com/cznic/b",
},
}, {
path: "github.com/pkg/sftp",
want: &gitrepo{
url: "https://github.com/pkg/sftp",
},
}, {
path: "github.com/pkg/sftp/examples/gsftp",
want: &gitrepo{
url: "https://github.com/pkg/sftp",
},
extra: "/examples/gsftp",
}, {
path: "github.com/coreos/go-etcd",
want: &gitrepo{
url: "https://github.com/coreos/go-etcd",
},
/*
bitbucket cannot maintain a stable ssh key across their app servers
and this mucks up ci testing because mercurial does not have any
way of unconditionally accepting new ssh keys for the host.
Great work TEAM.
}, {
path: "bitbucket.org/davecheney/gitrepo/cmd/main",
want: &gitrepo{
url: "https://bitbucket.org/davecheney/gitrepo",
},
extra: "/cmd/main",
}, {
path: "bitbucket.org/davecheney/hgrepo/cmd/main",
want: &hgrepo{
url: "https://bitbucket.org/davecheney/hgrepo",
},
extra: "/cmd/main",
*/
}, {
/* path has either changed or is now 403
path: "git.eclipse.org/gitroot/paho/org.eclipse.paho.mqtt.golang.git",
want: &gitrepo{
url: "https://git.eclipse.org/gitroot/paho/org.eclipse.paho.mqtt.golang.git",
},
}, {
*/
path: "git.apache.org/thrift.git/lib/go/thrift",
want: &gitrepo{
url: "https://git.apache.org/thrift.git",
},
extra: "/lib/go/thrift",
}, {
path: "gopkg.in/check.v1",
want: &gitrepo{
url: "https://gopkg.in/check.v1",
},
extra: "",
}, {
path: "goji.io",
want: &gitrepo{
url: "https://github.com/goji/goji",
},
extra: "",
}, {
path: "golang.org/x/tools/go/vcs",
want: &gitrepo{
url: "https://go.googlesource.com/tools",
},
extra: "/go/vcs",
}, {
path: "labix.org/v2/mgo",
want: &bzrrepo{
url: "https://launchpad.net/mgo/v2",
},
insecure: true,
}, {
path: "launchpad.net/gnuflag",
want: &bzrrepo{
url: "https://launchpad.net/gnuflag",
},
}, {
path: "https://github.com/pkg/sftp",
want: &gitrepo{
url: "https://github.com/pkg/sftp",
},
}, {
path: "git://github.com/pkg/sftp",
want: &gitrepo{
url: "git://github.com/pkg/sftp",
},
insecure: true,
}}
for _, tt := range tests {
t.Logf("DeduceRemoteRepo(%q, %v)", tt.path, tt.insecure)
got, extra, err := DeduceRemoteRepo(tt.path, tt.insecure)
if !reflect.DeepEqual(err, tt.err) {
t.Errorf("DeduceRemoteRepo(%q): want err: %v, got err: %v", tt.path, tt.err, err)
continue
}
if !reflect.DeepEqual(got, tt.want) || extra != tt.extra {
t.Errorf("DeduceRemoteRepo(%q): want %#v, %v, got %#v, %v", tt.path, tt.want, tt.extra, got, extra)
}
}
}
|