(t *testing.T)
| 148 | } |
| 149 | |
| 150 | func TestDetectShellPrioritizesVersionVariable(t *testing.T) { |
| 151 | // Save original environment |
| 152 | originalShell := os.Getenv("SHELL") |
| 153 | originalBashVersion := os.Getenv("BASH_VERSION") |
| 154 | originalZshVersion := os.Getenv("ZSH_VERSION") |
| 155 | |
| 156 | // Restore environment after test |
| 157 | defer func() { |
| 158 | os.Setenv("SHELL", originalShell) |
| 159 | os.Setenv("BASH_VERSION", originalBashVersion) |
| 160 | os.Setenv("ZSH_VERSION", originalZshVersion) |
| 161 | }() |
| 162 | |
| 163 | // Set SHELL to bash but ZSH_VERSION is set (running zsh inside bash) |
| 164 | os.Setenv("SHELL", "/bin/bash") |
| 165 | os.Setenv("ZSH_VERSION", "5.8") |
| 166 | os.Unsetenv("BASH_VERSION") |
| 167 | |
| 168 | detected := DetectShell() |
| 169 | |
| 170 | // Should prioritize ZSH_VERSION over SHELL |
| 171 | assert.Equal(t, ShellZsh, detected) |
| 172 | } |
| 173 | |
| 174 | func TestShellTypeString(t *testing.T) { |
| 175 | tests := []struct { |
nothing calls this directly
no test coverage detected