TestWorktreeFilesystemMkdirAllRootIsNoop locks in the contract that MkdirAll on a root-equivalent path is a silent no-op against the wrapper. validPath itself still rejects "", ".", and "/" (see TestValidPath), but MkdirAll specifically tolerates them because "ensure the root exists" is always trivi
(t *testing.T)
| 3252 | // TestValidPath), but MkdirAll specifically tolerates them because |
| 3253 | // "ensure the root exists" is always trivially satisfied. |
| 3254 | func TestWorktreeFilesystemMkdirAllRootIsNoop(t *testing.T) { |
| 3255 | t.Parallel() |
| 3256 | |
| 3257 | rootPaths := []string{"", ".", "/"} |
| 3258 | for _, p := range rootPaths { |
| 3259 | t.Run(p, func(t *testing.T) { |
| 3260 | t.Parallel() |
| 3261 | |
| 3262 | mfs := memfs.New() |
| 3263 | fs := newWorktreeFilesystem(mfs, true, true) |
| 3264 | |
| 3265 | require.NoError(t, fs.MkdirAll(p, 0o755)) |
| 3266 | |
| 3267 | entries, err := mfs.ReadDir("/") |
| 3268 | require.NoError(t, err) |
| 3269 | assert.Empty(t, entries, "MkdirAll(%q) must not materialise a directory entry", p) |
| 3270 | }) |
| 3271 | } |
| 3272 | } |
| 3273 | |
| 3274 | var statusCodeNames = map[StatusCode]string{ |
| 3275 | Unmodified: "Unmodified", |
nothing calls this directly
no test coverage detected
searching dependent graphs…