MCPcopy Create free account
hub / github.com/docker-exec/dexec / TestSanitisePath

Function TestSanitisePath

util/util_test.go:8–24  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

6)
7
8func TestSanitisePath(t *testing.T) {
9 cases := []struct {
10 path string
11 platform string
12 want string
13 }{
14 {"/Users/foo/bar", "darin", "/Users/foo/bar"},
15 {"/home/foo/bar", "linux", "/home/foo/bar"},
16 {"C:\\Users\\foo\\bar", "windows", "/c/Users/foo/bar"},
17 }
18 for _, c := range cases {
19 gotSanitisedPath := SanitisePath(c.path, c.platform)
20 if gotSanitisedPath != c.want {
21 t.Errorf("SanitisedPath %q != %q", gotSanitisedPath, c.want)
22 }
23 }
24}
25
26func TestAddPrefix(t *testing.T) {
27 cases := []struct {

Callers

nothing calls this directly

Calls 1

SanitisePathFunction · 0.85

Tested by

no test coverage detected