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

sleep: give usage error on invalid time interval

For example,

    $ sleep xyz
    sleep: invalid time interval 'xyz'
    Try 'sleep --help' for more information.

This matches the behavior of GNU sleep.
This commit is contained in:
Jeffrey Finkelstein 2022-03-20 15:21:50 -04:00
parent 04b219bdef
commit c39c917db7
2 changed files with 10 additions and 2 deletions

View file

@ -3,6 +3,14 @@ use crate::common::util::*;
use std::time::{Duration, Instant};
#[test]
fn test_invalid_time_interval() {
new_ucmd!()
.arg("xyz")
.fails()
.usage_error("invalid time interval 'xyz'");
}
#[test]
fn test_sleep_no_suffix() {
let millis_100 = Duration::from_millis(100);