(t *testing.T)
| 22 | ) |
| 23 | |
| 24 | func TestLooksLikePath(t *testing.T) { |
| 25 | type pathTest struct { |
| 26 | v string |
| 27 | want bool |
| 28 | } |
| 29 | tests := []pathTest{ |
| 30 | {"foo.com", false}, |
| 31 | {"127.0.0.1:234", false}, |
| 32 | {"foo", false}, |
| 33 | |
| 34 | {"/foo", true}, |
| 35 | {"./foo", true}, |
| 36 | {"../foo", true}, |
| 37 | } |
| 38 | if runtime.GOOS == "windows" { |
| 39 | tests = append(tests, |
| 40 | pathTest{`\foo`, true}, |
| 41 | pathTest{`.\foo`, true}, |
| 42 | pathTest{`..\foo`, true}, |
| 43 | pathTest{`C:/dir`, true}, |
| 44 | pathTest{`C:\dir`, true}, |
| 45 | pathTest{`//server/share/dir`, true}, |
| 46 | pathTest{`\\server\share\dir`, true}, |
| 47 | ) |
| 48 | } |
| 49 | for _, tt := range tests { |
| 50 | got := looksLikePath(tt.v) |
| 51 | if got != tt.want { |
| 52 | t.Errorf("looksLikePath(%q) = %v; want %v", tt.v, got, tt.want) |
| 53 | } |
| 54 | } |
| 55 | } |
nothing calls this directly
no test coverage detected