MCPcopy
hub / github.com/syncthing/syncthing / TestDirNames

Function TestDirNames

lib/fs/basicfs_test.go:213–239  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

211}
212
213func TestDirNames(t *testing.T) {
214 fs, dir := setup(t)
215
216 // Case differences
217 testCases := []string{
218 "a",
219 "bC",
220 }
221 slices.Sort(testCases)
222
223 for _, sub := range testCases {
224 if err := os.Mkdir(filepath.Join(dir, sub), 0o777); err != nil {
225 t.Error(err)
226 }
227 }
228
229 if dirs, err := fs.DirNames("."); err != nil || len(dirs) != len(testCases) {
230 t.Errorf("%s %s %s", err, dirs, testCases)
231 } else {
232 slices.Sort(dirs)
233 for i := range dirs {
234 if dirs[i] != testCases[i] {
235 t.Errorf("%s != %s", dirs[i], testCases[i])
236 }
237 }
238 }
239}
240
241func TestNames(t *testing.T) {
242 // Tests that all names are without the root directory.

Callers

nothing calls this directly

Calls 5

setupFunction · 0.85
SortMethod · 0.80
MkdirMethod · 0.65
ErrorMethod · 0.65
DirNamesMethod · 0.65

Tested by

no test coverage detected