MCPcopy Index your code
hub / github.com/cli/cli / Test_parseRemoteURLOrName

Function Test_parseRemoteURLOrName

git/client_test.go:905–949  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

903}
904
905func Test_parseRemoteURLOrName(t *testing.T) {
906 tests := []struct {
907 name string
908 value string
909 wantRemoteURL *url.URL
910 wantRemoteName string
911 }{
912 {
913 name: "empty value",
914 value: "",
915 wantRemoteURL: nil,
916 wantRemoteName: "",
917 },
918 {
919 name: "remote URL",
920 value: "git@github.com:foo/bar.git",
921 wantRemoteURL: &url.URL{
922 Scheme: "ssh",
923 User: url.User("git"),
924 Host: "github.com",
925 Path: "/foo/bar.git",
926 },
927 wantRemoteName: "",
928 },
929 {
930 name: "remote name",
931 value: "origin",
932 wantRemoteURL: nil,
933 wantRemoteName: "origin",
934 },
935 {
936 name: "remote name is from filesystem",
937 value: "./path/to/repo",
938 wantRemoteURL: nil,
939 wantRemoteName: "",
940 },
941 }
942 for _, tt := range tests {
943 t.Run(tt.name, func(t *testing.T) {
944 remoteURL, remoteName := parseRemoteURLOrName(tt.value)
945 assert.Equal(t, tt.wantRemoteURL, remoteURL)
946 assert.Equal(t, tt.wantRemoteName, remoteName)
947 })
948 }
949}
950
951func TestClientPushDefault(t *testing.T) {
952 tests := []struct {

Callers

nothing calls this directly

Calls 3

parseRemoteURLOrNameFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected