MCPcopy
hub / github.com/syncthing/syncthing / TestOSWindowsRemoveAll

Function TestOSWindowsRemoveAll

lib/model/utils_test.go:101–128  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

99}
100
101func TestOSWindowsRemoveAll(t *testing.T) {
102 if !build.IsWindows {
103 t.Skipf("Tests not required")
104 return
105 }
106
107 fs := fs.NewFilesystem(fs.FilesystemTypeFake, rand.String(32))
108
109 create := func(name string) error {
110 fd, err := fs.Create(name)
111 if err != nil {
112 return err
113 }
114 fd.Close()
115 return nil
116 }
117
118 fs.Mkdir("testdata", 0o700)
119
120 fs.Mkdir("testdata/windows", 0o500)
121 fs.Mkdir("testdata/windows/ro", 0o500)
122 create("testdata/windows/ro/readonly")
123 fs.Chmod("testdata/windows/ro/readonly", 0o500)
124
125 if err := fs.RemoveAll("testdata/windows"); err != nil {
126 t.Errorf("Unexpected error: %s", err)
127 }
128}
129
130func TestInWritableDirWindowsRename(t *testing.T) {
131 if !build.IsWindows {

Callers

nothing calls this directly

Calls 6

CreateMethod · 0.95
MkdirMethod · 0.95
ChmodMethod · 0.95
RemoveAllMethod · 0.95
StringFunction · 0.92
CloseMethod · 0.65

Tested by

no test coverage detected