MCPcopy Create free account
hub / github.com/VirusTotal/vt-cli / Test_pathDepth

Function Test_pathDepth

utils/file_utils_test.go:221–257  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

219}
220
221func Test_pathDepth(t *testing.T) {
222 t.Parallel()
223
224 useCases := []struct {
225 name string
226 dir string
227 want int
228 }{
229 {
230 name: "want one depth when empty directory",
231 want: 1,
232 },
233 {
234 name: "want one depth when simple directory",
235 dir: "a",
236 want: 1,
237 },
238 {
239 name: "want 2 depth when sub directory",
240 dir: "a/a",
241 want: 2,
242 },
243 {
244 name: "want 3 depth when sub directory",
245 dir: "a-a/b_bb__/cccc/",
246 want: 3,
247 },
248 }
249
250 for _, uc := range useCases {
251 t.Run(uc.name, func(t *testing.T) {
252 if got, want := pathDepth(uc.dir), uc.want; got != want {
253 t.Errorf("unexpected pathDepth, got:%v, want:%v", got, want)
254 }
255 })
256 }
257}

Callers

nothing calls this directly

Calls 1

pathDepthFunction · 0.85

Tested by

no test coverage detected