MCPcopy
hub / github.com/git-lfs/git-lfs / TestDirWalkerWalk

Function TestDirWalkerWalk

tools/dir_walker_test.go:124–473  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

122}
123
124func TestDirWalkerWalk(t *testing.T) {
125 wd, err := os.Getwd()
126 require.NoError(t, err)
127
128 defer os.Chdir(wd)
129
130 for desc, c := range map[string]*dirWalkerWalkTestCase{
131 "empty path": {},
132 "one extant dir": {
133 path: "abc",
134 existsPath: "abc",
135 expectedParentPath: "abc",
136 },
137 "one missing dir": {
138 path: "abc",
139 expectedPath: "abc",
140 expectedErr: os.ErrNotExist,
141 },
142 "two extant dirs": {
143 path: "abc/def",
144 existsPath: "abc/def",
145 expectedParentPath: "abc/def",
146 },
147 "two missing dirs": {
148 path: "abc/def",
149 expectedPath: "abc/def",
150 expectedErr: os.ErrNotExist,
151 },
152 "three extant dirs": {
153 path: "abc/def/ghi",
154 existsPath: "abc/def/ghi",
155 expectedParentPath: "abc/def/ghi",
156 },
157 "three missing dirs": {
158 path: "abc/def/ghi",
159 expectedPath: "abc/def/ghi",
160 expectedErr: os.ErrNotExist,
161 },
162 "one extant dir and one missing dir": {
163 path: "abc/def",
164 existsPath: "abc",
165 expectedParentPath: "abc",
166 expectedPath: "def",
167 expectedErr: os.ErrNotExist,
168 },
169 "one extant dir and two missing dirs": {
170 path: "abc/def/ghi",
171 existsPath: "abc",
172 expectedParentPath: "abc",
173 expectedPath: "def/ghi",
174 expectedErr: os.ErrNotExist,
175 },
176 "two extant dirs and one missing dir": {
177 path: "abc/def/ghi",
178 existsPath: "abc/def",
179 expectedParentPath: "abc/def",
180 expectedPath: "ghi",
181 expectedErr: os.ErrNotExist,

Callers

nothing calls this directly

Calls 5

setupPathsMethod · 0.80
ErrorfMethod · 0.65
ErrorMethod · 0.65
RunMethod · 0.65
TempDirMethod · 0.45

Tested by

no test coverage detected