MCPcopy
hub / github.com/syncthing/syncthing / TestOSWindowsRemove

Function TestOSWindowsRemove

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

Source from the content-addressed store, hash-verified

67}
68
69func TestOSWindowsRemove(t *testing.T) {
70 if !build.IsWindows {
71 t.Skipf("Tests not required")
72 return
73 }
74
75 fs := fs.NewFilesystem(fs.FilesystemTypeFake, rand.String(32))
76
77 create := func(name string) error {
78 fd, err := fs.Create(name)
79 if err != nil {
80 return err
81 }
82 fd.Close()
83 return nil
84 }
85
86 fs.Mkdir("testdata", 0o700)
87
88 fs.Mkdir("testdata/windows", 0o500)
89 fs.Mkdir("testdata/windows/ro", 0o500)
90 create("testdata/windows/ro/readonly")
91 fs.Chmod("testdata/windows/ro/readonly", 0o500)
92
93 for _, path := range []string{"testdata/windows/ro/readonly", "testdata/windows/ro", "testdata/windows"} {
94 err := inWritableDir(fs.Remove, fs, path, false)
95 if err != nil {
96 t.Errorf("Unexpected error %s: %s", path, err)
97 }
98 }
99}
100
101func TestOSWindowsRemoveAll(t *testing.T) {
102 if !build.IsWindows {

Callers

nothing calls this directly

Calls 6

CreateMethod · 0.95
MkdirMethod · 0.95
ChmodMethod · 0.95
StringFunction · 0.92
inWritableDirFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected