(t *testing.T)
| 903 | } |
| 904 | |
| 905 | func 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 | |
| 951 | func TestClientPushDefault(t *testing.T) { |
| 952 | tests := []struct { |
nothing calls this directly
no test coverage detected