mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
sleep: use Duration::saturating_add to sum times
Use `Duration::saturating_add()` to avoid a panic due to overflow when adding the durations provided as command-line arguments.
This commit is contained in:
parent
388cb6c83a
commit
ce2a026ff8
2 changed files with 11 additions and 1 deletions
|
@ -131,3 +131,13 @@ fn test_dont_overflow() {
|
|||
.no_stderr()
|
||||
.no_stdout();
|
||||
}
|
||||
|
||||
// #[test]
|
||||
#[allow(dead_code)]
|
||||
fn test_sum_overflow() {
|
||||
new_ucmd!()
|
||||
.args(&["100000000000000d", "100000000000000d", "100000000000000d"])
|
||||
.succeeds()
|
||||
.no_stderr()
|
||||
.no_stdout();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue