(t *testing.T)
| 184 | } |
| 185 | |
| 186 | func 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 | |
| 221 | func TestFileSystemUploadMultipart(t *testing.T) { |
| 222 | dir := createTestDir(t) |
nothing calls this directly
no test coverage detected
searching dependent graphs…