(t *testing.T)
| 21 | ) |
| 22 | |
| 23 | func TestIsURLRelative(t *testing.T) { |
| 24 | t.Parallel() |
| 25 | |
| 26 | data := []struct { |
| 27 | Rawurl string |
| 28 | Relative bool |
| 29 | }{ |
| 30 | {"foobar", true}, |
| 31 | {"./foobar", true}, |
| 32 | {"/foobar", false}, |
| 33 | |
| 34 | {"file://foobar", true}, |
| 35 | {"file://./foobar", true}, |
| 36 | {"file://../foobar", true}, |
| 37 | {"file://../../foobar", true}, |
| 38 | {"file:///foobar", false}, |
| 39 | |
| 40 | {"http://foo.bar", false}, |
| 41 | } |
| 42 | |
| 43 | for _, d := range data { |
| 44 | u, err := url.Parse(d.Rawurl) |
| 45 | if err != nil { |
| 46 | panic("Wrong URL") |
| 47 | } |
| 48 | if isURLRelative(u) != d.Relative { |
| 49 | t.Error("Mismatch on", d) |
| 50 | } |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | func TestFixRelativeURL(t *testing.T) { |
| 55 | t.Parallel() |
nothing calls this directly
no test coverage detected