Commit graph

15 commits

Author SHA1 Message Date
Daniel Hofstetter
ad37db8da3 sleep: fix broken tests due to fundu update 2023-05-01 14:25:59 +02:00
Daniel Hofstetter
6988eb7ec6 tests: expand wildcard imports 2023-03-20 15:32:35 +01:00
Joining7943
5fb091a4fb sleep: Use fundu error types to improve error messages 2023-03-12 15:37:44 +01:00
Joining7943
71bbebdc76 sleep: Fix whitespace issues. Don't panic when adding durations.
Refactor error propagation and use show_error! instead of USimpleError.
2023-03-07 13:33:49 +01:00
Joining7943
68f75af678 sleep: Fix duration parsing of multiple inputs when duration overflow should saturate and not panic 2023-02-28 08:04:55 +01:00
Roy Ivy III
f8b545d6f8 test/sleep: add and refine sleep test cases 2023-01-08 12:10:32 -06:00
Jeffrey Finkelstein
f4af226820 uucore: error on negative interval in parse_time
Return an error when a negative interval is provided as the argument
to `uucore::parse_time::from_str()`, since a `Duration` should only be
non-negative.
2022-03-21 21:11:31 -04:00
Jeffrey Finkelstein
c39c917db7 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.
2022-03-20 15:21:50 -04:00
Jeffrey Finkelstein
ce2a026ff8 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.
2022-03-18 23:15:02 -04:00
Jeffrey Finkelstein
388cb6c83a uucore: use Duration::saturating_mul in parse_time
Use `Duration::saturating_mul()` to avoid a panic due to overflow in
`uucore::parse_time::from_str()`. This change prevents panic on very
large arguments to timeout and sleep.
2022-03-18 23:15:02 -04:00
Terts Diepraam
337d257e8d tests/sleep: fmt 2021-07-12 20:21:20 +02:00
Son Nguyen
6c26976edb
sleep: use UResult (#2492)
* sleep: use UResult in util

* sleep: add in error + test for it

* sleep: UResult - removed some verbosity
2021-07-12 20:20:23 +02:00
Andre Julius
53c3fedf33 sleep: Add more test cases
As mentioned here:
https://github.com/uutils/coreutils/pull/1777#discussion_r593807712
2021-03-15 14:36:38 +01:00
Andre Julius
2158b2c5b4
sleep: move from getopts to clap #1735 (#1777)
and Add some sleep test cases #1735
2021-03-13 23:11:11 +01:00
Roy Ivy III
1b3bb56e66 tests ~ add missing test_UTIL module files (with 'ToDO' comments)
- common_core utils
- additional 'windows' utils
- additional 'unix' utils
2020-06-02 11:25:09 -05:00