MCPcopy
hub / github.com/pocketbase/pocketbase / TestFileSystemDelete

Function TestFileSystemDelete

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

Source from the content-addressed store, hash-verified

97}
98
99func TestFileSystemDelete(t *testing.T) {
100 dir := createTestDir(t)
101 defer os.RemoveAll(dir)
102
103 fsys, err := filesystem.NewLocal(dir)
104 if err != nil {
105 t.Fatal(err)
106 }
107 defer fsys.Close()
108
109 if err := fsys.Delete("missing.txt"); err == nil || !errors.Is(err, filesystem.ErrNotFound) {
110 t.Fatalf("Expected ErrNotFound error, got %v", err)
111 }
112
113 if err := fsys.Delete("image.png"); err != nil {
114 t.Fatalf("Expected nil, got error %v", err)
115 }
116}
117
118func TestFileSystemDeletePrefixWithoutTrailingSlash(t *testing.T) {
119 dir := createTestDir(t)

Callers

nothing calls this directly

Calls 6

NewLocalFunction · 0.92
IsMethod · 0.80
createTestDirFunction · 0.70
CloseMethod · 0.65
DeleteMethod · 0.65
RemoveAllMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…