Skip to content

Commit

Permalink
refactor(process): improve invalid PID test robustness using i32::MAX
Browse files Browse the repository at this point in the history
- Replace arbitrary 999_999 PID with i32::MAX for guaranteed invalid PID
- Add better documentation explaining the test's guarantees
- Ensure test remains valid across all Unix platforms
  • Loading branch information
jamesbrink committed Feb 10, 2025
1 parent eee7e8c commit 5d69f6b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@ mod tests {

#[test]
fn test_invalid_process() {
// Using a very large PID that's unlikely to exist
let controller = ProcessController::new(999_999);
// Using maximum possible PID value which is guaranteed to be invalid
// as it exceeds system limits on all Unix platforms
let controller = ProcessController::new(i32::MAX);
assert!(!controller.is_running());
assert!(controller.pause().is_err());
assert!(controller.resume().is_err());
Expand Down

0 comments on commit 5d69f6b

Please sign in to comment.