(t *testing.T)
| 248 | } |
| 249 | |
| 250 | func TestResolveWorkDir(t *testing.T) { |
| 251 | t.Parallel() |
| 252 | |
| 253 | workingDir := "/configured/project" |
| 254 | h := &shellHandler{workingDir: workingDir} |
| 255 | |
| 256 | tests := []struct { |
| 257 | name string |
| 258 | cwd string |
| 259 | expected string |
| 260 | }{ |
| 261 | {name: "empty defaults to workingDir", cwd: "", expected: workingDir}, |
| 262 | {name: "dot defaults to workingDir", cwd: ".", expected: workingDir}, |
| 263 | {name: "absolute path unchanged", cwd: "/tmp/other", expected: "/tmp/other"}, |
| 264 | {name: "relative path joined with workingDir", cwd: "src/pkg", expected: "/configured/project/src/pkg"}, |
| 265 | {name: "relative with dot prefix", cwd: "./subdir", expected: "/configured/project/subdir"}, |
| 266 | {name: "relative with parent traversal", cwd: "../sibling", expected: "/configured/sibling"}, |
| 267 | } |
| 268 | |
| 269 | for _, tt := range tests { |
| 270 | t.Run(tt.name, func(t *testing.T) { |
| 271 | t.Parallel() |
| 272 | assert.Equal(t, tt.expected, h.resolveWorkDir(tt.cwd)) |
| 273 | }) |
| 274 | } |
| 275 | } |
| 276 | |
| 277 | func TestShellTool_RelativeCwdResolvesAgainstWorkingDir(t *testing.T) { |
| 278 | t.Parallel() |
nothing calls this directly
no test coverage detected