MCPcopy Index your code
hub / github.com/perkeep/perkeep / TestLooksLikePath

Function TestLooksLikePath

cmd/pk/sync_test.go:24–55  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

22)
23
24func 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}

Callers

nothing calls this directly

Calls 1

looksLikePathFunction · 0.85

Tested by

no test coverage detected