MCPcopy
hub / github.com/davecheney/httpstat / TestParseURL

Function TestParseURL

main_test.go:5–24  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3import "testing"
4
5func TestParseURL(t *testing.T) {
6 tests := []struct {
7 in string
8 want string
9 }{
10 {"https://golang.org", "https://golang.org"},
11 {"https://golang.org:443/test", "https://golang.org:443/test"},
12 {"localhost:8080/test", "https://localhost:8080/test"},
13 {"localhost:80/test", "http://localhost:80/test"},
14 {"//localhost:8080/test", "https://localhost:8080/test"},
15 {"//localhost:80/test", "http://localhost:80/test"},
16 }
17
18 for _, test := range tests {
19 u := parseURL(test.in)
20 if u.String() != test.want {
21 t.Errorf("Given: %s\nwant: %s\ngot: %s", test.in, test.want, u.String())
22 }
23 }
24}

Callers

nothing calls this directly

Calls 2

parseURLFunction · 0.85
StringMethod · 0.80

Tested by

no test coverage detected