mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
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.
This commit is contained in:
parent
5eeac5881a
commit
f4af226820
3 changed files with 25 additions and 0 deletions
|
@ -149,3 +149,11 @@ fn test_sum_overflow() {
|
|||
.no_stderr()
|
||||
.no_stdout();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_negative_interval() {
|
||||
new_ucmd!()
|
||||
.args(&["--", "-1"])
|
||||
.fails()
|
||||
.usage_error("invalid time interval '-1'");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue