MCPcopy Index your code
hub / github.com/jetify-com/devbox / TestInitShellBinaryFields

Function TestInitShellBinaryFields

internal/devbox/shell_test.go:256–340  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

254}
255
256func 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) {

Callers

nothing calls this directly

Calls 3

ConfigSubpathFunction · 0.92
initShellBinaryFieldsFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected