MCPcopy Create free account
hub / github.com/dropbox/dbxcli / TestValidatePath

Function TestValidatePath

cmd/dropbox_path_test.go:10–35  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestValidatePath(t *testing.T) {
11 tests := []struct {
12 input string
13 want string
14 }{
15 {"/", ""},
16 {"/foo", "/foo"},
17 {"foo", "/foo"},
18 {"/foo/", "/foo"},
19 {"/foo/bar", "/foo/bar"},
20 {"foo/bar/", "/foo/bar"},
21 {"/foo//bar", "/foo/bar"},
22 {"foo//bar/", "/foo/bar"},
23 }
24
25 for _, tt := range tests {
26 got, err := validatePath(tt.input)
27 if err != nil {
28 t.Errorf("validatePath(%q) returned error: %v", tt.input, err)
29 continue
30 }
31 if got != tt.want {
32 t.Errorf("validatePath(%q) = %q, want %q", tt.input, got, tt.want)
33 }
34 }
35}
36
37func TestValidatePathRootBecomesEmpty(t *testing.T) {
38 got, err := validatePath("/")

Callers

nothing calls this directly

Calls 1

validatePathFunction · 0.85

Tested by

no test coverage detected