=================================================================== Parser unit tests — parsePsOutput ===================================================================
(t *testing.T)
| 265 | // =================================================================== |
| 266 | |
| 267 | func TestParsePsOutput_Windows(t *testing.T) { |
| 268 | t.Parallel() |
| 269 | resp := parsePsOutput(windowsTasklistOutput, "Windows") |
| 270 | |
| 271 | if len(resp.Processes) != 5 { |
| 272 | t.Fatalf("expected 5 processes, got %d", len(resp.Processes)) |
| 273 | } |
| 274 | |
| 275 | // Verify System process. |
| 276 | p := resp.Processes[1] |
| 277 | if p.Name != "System" || p.Pid != 4 { |
| 278 | t.Errorf("expected System PID=4, got name=%q pid=%d", p.Name, p.Pid) |
| 279 | } |
| 280 | if p.Owner != "Services" { |
| 281 | t.Errorf("expected owner=Services, got %q", p.Owner) |
| 282 | } |
| 283 | |
| 284 | // Verify explorer.exe. |
| 285 | p = resp.Processes[4] |
| 286 | if p.Name != "explorer.exe" || p.Pid != 12456 { |
| 287 | t.Errorf("expected explorer.exe PID=12456, got name=%q pid=%d", p.Name, p.Pid) |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | func TestParsePsOutput_Linux(t *testing.T) { |
| 292 | t.Parallel() |
nothing calls this directly
no test coverage detected