diff options
Diffstat (limited to 'tests/cli.rs')
| -rw-r--r-- | tests/cli.rs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/cli.rs b/tests/cli.rs index 7cb68b7..05e3efd 100644 --- a/tests/cli.rs +++ b/tests/cli.rs | |||
| @@ -343,4 +343,37 @@ fn test_invalid_process_id() { | |||
| 343 | .assert() | 343 | .assert() |
| 344 | .success() | 344 | .success() |
| 345 | .stdout(predicate::str::contains("invalid PID file")); | 345 | .stdout(predicate::str::contains("invalid PID file")); |
| 346 | } | ||
| 347 | |||
| 348 | #[test] | ||
| 349 | fn test_list_quiet_mode() { | ||
| 350 | let temp_dir = TempDir::new().unwrap(); | ||
| 351 | |||
| 352 | // Test quiet mode with no processes | ||
| 353 | let mut cmd = Command::cargo_bin("demon").unwrap(); | ||
| 354 | cmd.current_dir(temp_dir.path()) | ||
| 355 | .args(&["list", "--quiet"]) | ||
| 356 | .assert() | ||
| 357 | .success() | ||
| 358 | .stdout(predicate::str::is_empty()); | ||
| 359 | |||
| 360 | // Create a process | ||
| 361 | let mut cmd = Command::cargo_bin("demon").unwrap(); | ||
| 362 | cmd.current_dir(temp_dir.path()) | ||
| 363 | .args(&["run", "--id", "quiet-test", "echo", "done"]) | ||
| 364 | .assert() | ||
| 365 | .success(); | ||
| 366 | |||
| 367 | // Test quiet mode with process - should output colon-separated format | ||
| 368 | let mut cmd = Command::cargo_bin("demon").unwrap(); | ||
| 369 | cmd.current_dir(temp_dir.path()) | ||
| 370 | .args(&["list", "-q"]) | ||
| 371 | .assert() | ||
| 372 | .success() | ||
| 373 | .stdout(predicate::str::contains("quiet-test:")) | ||
| 374 | .stdout(predicate::str::contains(":DEAD")) | ||
| 375 | // Should not contain headers | ||
| 376 | .stdout(predicate::str::contains("ID").not()) | ||
| 377 | .stdout(predicate::str::contains("PID").not()) | ||
| 378 | .stdout(predicate::str::contains("STATUS").not()); | ||
| 346 | } \ No newline at end of file | 379 | } \ No newline at end of file |
