(t *testing.T)
| 137 | } |
| 138 | |
| 139 | func TestExtractDomainFromURL(t *testing.T) { |
| 140 | tests := []struct { |
| 141 | url string |
| 142 | expected string |
| 143 | }{ |
| 144 | {"http://example.com/path", "example.com"}, |
| 145 | {"https://api.github.com/repos", "api.github.com"}, |
| 146 | {"github.com:443", "github.com"}, |
| 147 | {"malicious.site", "malicious.site"}, |
| 148 | {"http://sub.domain.com:8080/path", "sub.domain.com"}, |
| 149 | } |
| 150 | |
| 151 | for _, tt := range tests { |
| 152 | t.Run(tt.url, func(t *testing.T) { |
| 153 | result := stringutil.ExtractDomainFromURL(tt.url) |
| 154 | assert.Equal(t, tt.expected, result, "should extract correct domain from URL") |
| 155 | }) |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | func TestParseSquidLogLine(t *testing.T) { |
| 160 | tests := []struct { |
nothing calls this directly
no test coverage detected