(t *testing.T)
| 254 | } |
| 255 | |
| 256 | func TestInitShellBinaryFields(t *testing.T) { |
| 257 | tests := []struct { |
| 258 | name string |
| 259 | path string |
| 260 | env map[string]string |
| 261 | expectedName name |
| 262 | expectedRcPath string |
| 263 | expectedRcPathBase string |
| 264 | }{ |
| 265 | { |
| 266 | name: "bash shell", |
| 267 | path: "/usr/bin/bash", |
| 268 | expectedName: shBash, |
| 269 | expectedRcPathBase: ".bashrc", |
| 270 | }, |
| 271 | { |
| 272 | name: "zsh shell without ZDOTDIR", |
| 273 | path: "/usr/bin/zsh", |
| 274 | expectedName: shZsh, |
| 275 | expectedRcPathBase: ".zshrc", |
| 276 | }, |
| 277 | { |
| 278 | name: "zsh shell with ZDOTDIR", |
| 279 | path: "/usr/bin/zsh", |
| 280 | env: map[string]string{ |
| 281 | "ZDOTDIR": "/custom/zsh/config", |
| 282 | }, |
| 283 | expectedName: shZsh, |
| 284 | expectedRcPath: "/custom/zsh/config/.zshrc", |
| 285 | }, |
| 286 | { |
| 287 | name: "ksh shell", |
| 288 | path: "/usr/bin/ksh", |
| 289 | expectedName: shKsh, |
| 290 | expectedRcPathBase: ".kshrc", |
| 291 | }, |
| 292 | { |
| 293 | name: "fish shell", |
| 294 | path: "/usr/bin/fish", |
| 295 | expectedName: shFish, |
| 296 | expectedRcPath: xdg.ConfigSubpath("fish/config.fish"), |
| 297 | }, |
| 298 | { |
| 299 | name: "dash shell", |
| 300 | path: "/usr/bin/dash", |
| 301 | expectedName: shPosix, |
| 302 | expectedRcPath: ".shinit", |
| 303 | }, |
| 304 | { |
| 305 | name: "unknown shell", |
| 306 | path: "/usr/bin/unknown", |
| 307 | expectedName: shUnknown, |
| 308 | expectedRcPathBase: "", |
| 309 | }, |
| 310 | } |
| 311 | |
| 312 | for _, test := range tests { |
| 313 | t.Run(test.name, func(t *testing.T) { |
nothing calls this directly
no test coverage detected