mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
Do not allow seq to run with an increment of zero
This commit is contained in:
parent
39d62c6c1f
commit
0dbed0fd59
2 changed files with 10 additions and 0 deletions
|
@ -133,6 +133,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
} else {
|
||||
1.0
|
||||
};
|
||||
if increment == 0.0 {
|
||||
show_error!("increment value: '{}'", &numbers[1][..]);
|
||||
return 1;
|
||||
}
|
||||
let last = {
|
||||
let slice = &numbers[numbers.len() - 1][..];
|
||||
padding = cmp::max(padding, slice.find('.').unwrap_or_else(|| slice.len()));
|
||||
|
|
|
@ -40,3 +40,9 @@ fn test_equalize_widths() {
|
|||
fn test_seq_wrong_arg() {
|
||||
new_ucmd!().args(&["-w", "5", "10", "33", "32"]).fails();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_zero_step() {
|
||||
new_ucmd!().args(&["10", "0", "32"]).fails();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue