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