TestFindBashPath tests FindBashPath
(t *testing.T)
| 388 | |
| 389 | // TestFindBashPath tests FindBashPath |
| 390 | func 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 |
| 420 | func TestFormatBytes(t *testing.T) { |
nothing calls this directly
no test coverage detected