MCPcopy Index your code
hub / github.com/ddev/ddev / TestFindBashPath

Function TestFindBashPath

pkg/util/utils_test.go:390–417  ·  view source on GitHub ↗

TestFindBashPath tests FindBashPath

(t *testing.T)

Source from the content-addressed store, hash-verified

388
389// TestFindBashPath tests FindBashPath
390func TestFindBashPath(t *testing.T) {
391 assert := asrt.New(t)
392
393 bashPath := util.FindBashPath()
394
395 // On non-Windows systems, it should return "bash"
396 if !nodeps.IsWindows() {
397 assert.Equal("bash", bashPath)
398 return
399 }
400
401 // On Windows, if bash is found, it should return a valid path
402 // We can't guarantee a specific path because it depends on the installation
403 if bashPath != "" {
404 // Should be an absolute path
405 require.True(t, filepath.IsAbs(bashPath), "Expected absolute path, got: %s", bashPath)
406
407 // Should end with bash.exe on Windows
408 assert.True(strings.HasSuffix(strings.ToLower(bashPath), "bash.exe"),
409 "Expected path ending with bash.exe, got: %s", bashPath)
410
411 // Verify the file exists
412 _, err := os.Stat(bashPath)
413 require.NoError(t, err, "Bash path %s does not exist", bashPath)
414 }
415 // Note: We don't fail if bashPath is empty because bash might not be installed
416 // in the test environment
417}
418
419// TestFormatBytes tests the byte formatting function
420func TestFormatBytes(t *testing.T) {

Callers

nothing calls this directly

Calls 2

FindBashPathFunction · 0.92
IsWindowsFunction · 0.92

Tested by

no test coverage detected