MCPcopy
hub / github.com/pocketbase/pocketbase / TestFileSystemIsEmptyDir

Function TestFileSystemIsEmptyDir

tools/filesystem/filesystem_test.go:186–219  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

184}
185
186func TestFileSystemIsEmptyDir(t *testing.T) {
187 dir := createTestDir(t)
188 defer os.RemoveAll(dir)
189
190 fsys, err := filesystem.NewLocal(dir)
191 if err != nil {
192 t.Fatal(err)
193 }
194 defer fsys.Close()
195
196 scenarios := []struct {
197 dir string
198 expected bool
199 }{
200 {"", false}, // special case that shouldn't be suffixed with delimiter to search for any files within the bucket
201 {"/", true},
202 {"missing", true},
203 {"missing/", true},
204 {"test", false},
205 {"test/", false},
206 {"empty", true},
207 {"empty/", true},
208 }
209
210 for _, s := range scenarios {
211 t.Run(s.dir, func(t *testing.T) {
212 result := fsys.IsEmptyDir(s.dir)
213
214 if result != s.expected {
215 t.Fatalf("Expected %v, got %v", s.expected, result)
216 }
217 })
218 }
219}
220
221func TestFileSystemUploadMultipart(t *testing.T) {
222 dir := createTestDir(t)

Callers

nothing calls this directly

Calls 6

NewLocalFunction · 0.92
IsEmptyDirMethod · 0.80
createTestDirFunction · 0.70
CloseMethod · 0.65
RemoveAllMethod · 0.45
RunMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…