| 211 | } |
| 212 | |
| 213 | func 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 | |
| 241 | func TestNames(t *testing.T) { |
| 242 | // Tests that all names are without the root directory. |