1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

Merge pull request #7648 from drinkcat/parse_time-ebd

timeout: Use common parser to parse time duration
This commit is contained in:
Sylvestre Ledru 2025-04-04 23:46:48 +02:00 committed by GitHub
commit 88cf66174f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 155 additions and 25 deletions

View file

@ -125,6 +125,24 @@ fn test_dont_overflow() {
.no_output();
}
#[test]
fn test_dont_underflow() {
new_ucmd!()
.args(&[".0000000001", "sleep", "1"])
.fails_with_code(124)
.no_output();
new_ucmd!()
.args(&["1e-100", "sleep", "1"])
.fails_with_code(124)
.no_output();
// Unlike GNU coreutils, we underflow to 1ns for very short timeouts.
// https://debbugs.gnu.org/cgi/bugreport.cgi?bug=77535
new_ucmd!()
.args(&["1e-18172487393827593258", "sleep", "1"])
.fails_with_code(124)
.no_output();
}
#[test]
fn test_negative_interval() {
new_ucmd!()