(t *testing.T)
| 204 | } |
| 205 | |
| 206 | func TestUnixShellName(t *testing.T) { |
| 207 | testCases := []struct { |
| 208 | name string |
| 209 | executable string |
| 210 | expected string |
| 211 | }{ |
| 212 | { |
| 213 | name: "returns basename of executable for full path", |
| 214 | executable: "/bin/bash", |
| 215 | expected: "bash", |
| 216 | }, |
| 217 | { |
| 218 | name: "returns basename for zsh", |
| 219 | executable: "/usr/bin/zsh", |
| 220 | expected: "zsh", |
| 221 | }, |
| 222 | { |
| 223 | name: "returns basename for sh", |
| 224 | executable: "/bin/sh", |
| 225 | expected: "sh", |
| 226 | }, |
| 227 | { |
| 228 | name: "returns executable name when no path", |
| 229 | executable: "bash", |
| 230 | expected: "bash", |
| 231 | }, |
| 232 | { |
| 233 | name: "handles complex paths", |
| 234 | executable: "/usr/local/bin/fish", |
| 235 | expected: "fish", |
| 236 | }, |
| 237 | } |
| 238 | |
| 239 | for _, tc := range testCases { |
| 240 | t.Run(tc.name, func(t *testing.T) { |
| 241 | shell := NewUnixShell(tc.executable) |
| 242 | result := shell.Name() |
| 243 | if result != tc.expected { |
| 244 | t.Errorf("Expected %s, got %s", tc.expected, result) |
| 245 | } |
| 246 | }) |
| 247 | } |
| 248 | } |
nothing calls this directly
no test coverage detected