(t *testing.T)
| 116 | } |
| 117 | |
| 118 | func TestDetectShellNoShellEnv(t *testing.T) { |
| 119 | // Save original environment |
| 120 | originalShell := os.Getenv("SHELL") |
| 121 | originalBashVersion := os.Getenv("BASH_VERSION") |
| 122 | originalZshVersion := os.Getenv("ZSH_VERSION") |
| 123 | originalFishVersion := os.Getenv("FISH_VERSION") |
| 124 | |
| 125 | // Restore environment after test |
| 126 | defer func() { |
| 127 | os.Setenv("SHELL", originalShell) |
| 128 | os.Setenv("BASH_VERSION", originalBashVersion) |
| 129 | os.Setenv("ZSH_VERSION", originalZshVersion) |
| 130 | os.Setenv("FISH_VERSION", originalFishVersion) |
| 131 | }() |
| 132 | |
| 133 | // Clear all shell environment variables |
| 134 | os.Unsetenv("SHELL") |
| 135 | os.Unsetenv("BASH_VERSION") |
| 136 | os.Unsetenv("ZSH_VERSION") |
| 137 | os.Unsetenv("FISH_VERSION") |
| 138 | |
| 139 | detected := DetectShell() |
| 140 | |
| 141 | // On Windows, should detect PowerShell |
| 142 | if runtime.GOOS == "windows" { |
| 143 | assert.Equal(t, ShellPowerShell, detected) |
| 144 | } else { |
| 145 | // On Unix-like systems, should be unknown |
| 146 | assert.Equal(t, ShellUnknown, detected) |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | func TestDetectShellPrioritizesVersionVariable(t *testing.T) { |
| 151 | // Save original environment |
nothing calls this directly
no test coverage detected