(t *testing.T)
| 63 | } |
| 64 | |
| 65 | func Test_makeAddressToDial(t *testing.T) { |
| 66 | t.Parallel() |
| 67 | |
| 68 | testCases := map[string]struct { |
| 69 | address string |
| 70 | addressToDial string |
| 71 | err error |
| 72 | }{ |
| 73 | "host without port": { |
| 74 | address: "test.com", |
| 75 | addressToDial: "test.com:443", |
| 76 | }, |
| 77 | "host with port": { |
| 78 | address: "test.com:80", |
| 79 | addressToDial: "test.com:80", |
| 80 | }, |
| 81 | "bad address": { |
| 82 | address: "test.com::", |
| 83 | err: fmt.Errorf("splitting host and port from address: address test.com::: too many colons in address"), //nolint:lll |
| 84 | }, |
| 85 | } |
| 86 | |
| 87 | for name, testCase := range testCases { |
| 88 | t.Run(name, func(t *testing.T) { |
| 89 | t.Parallel() |
| 90 | |
| 91 | addressToDial, err := makeAddressToDial(testCase.address) |
| 92 | |
| 93 | assert.Equal(t, testCase.addressToDial, addressToDial) |
| 94 | if testCase.err != nil { |
| 95 | assert.EqualError(t, err, testCase.err.Error()) |
| 96 | } else { |
| 97 | assert.NoError(t, err) |
| 98 | } |
| 99 | }) |
| 100 | } |
| 101 | } |
nothing calls this directly
no test coverage detected