MCPcopy Index your code
hub / github.com/coder/coder / TestFilePathToParts

Function TestFilePathToParts

agent/agentcontainers/ignore/dir_test.go:12–38  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestFilePathToParts(t *testing.T) {
13 t.Parallel()
14
15 tests := []struct {
16 path string
17 expected []string
18 }{
19 {"", []string{}},
20 {"/", []string{}},
21 {"foo", []string{"foo"}},
22 {"/foo", []string{"foo"}},
23 {"./foo/bar", []string{"foo", "bar"}},
24 {"../foo/bar", []string{"..", "foo", "bar"}},
25 {"foo/bar/baz", []string{"foo", "bar", "baz"}},
26 {"/foo/bar/baz", []string{"foo", "bar", "baz"}},
27 {"foo/../bar", []string{"bar"}},
28 }
29
30 for _, tt := range tests {
31 t.Run(fmt.Sprintf("`%s`", tt.path), func(t *testing.T) {
32 t.Parallel()
33
34 parts := ignore.FilePathToParts(tt.path)
35 require.Equal(t, tt.expected, parts)
36 })
37 }
38}

Callers

nothing calls this directly

Calls 3

FilePathToPartsFunction · 0.92
RunMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected