mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
seq: correct error message for zero increment
Change a word in the error message displayed when an increment value of 0 is provided to `seq`. This commit changes the message from "Zero increment argument" to "Zero increment value" to match the GNU `seq` error message.
This commit is contained in:
parent
b816e80e2f
commit
9dda23d8c6
2 changed files with 15 additions and 5 deletions
|
@ -40,11 +40,11 @@ impl SeqError {
|
||||||
fn argtype(&self) -> &str {
|
fn argtype(&self) -> &str {
|
||||||
match self {
|
match self {
|
||||||
SeqError::ParseError(_, e) => match e {
|
SeqError::ParseError(_, e) => match e {
|
||||||
ParseNumberError::Float => "floating point",
|
ParseNumberError::Float => "floating point argument",
|
||||||
ParseNumberError::Nan => "'not-a-number'",
|
ParseNumberError::Nan => "'not-a-number' argument",
|
||||||
ParseNumberError::Hex => "hexadecimal",
|
ParseNumberError::Hex => "hexadecimal argument",
|
||||||
},
|
},
|
||||||
SeqError::ZeroIncrement(_) => "Zero increment",
|
SeqError::ZeroIncrement(_) => "Zero increment value",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ impl Display for SeqError {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
"invalid {} argument: {}\nTry '{} --help' for more information.",
|
"invalid {}: {}\nTry '{} --help' for more information.",
|
||||||
self.argtype(),
|
self.argtype(),
|
||||||
self.arg().quote(),
|
self.arg().quote(),
|
||||||
uucore::execution_phrase(),
|
uucore::execution_phrase(),
|
||||||
|
|
|
@ -701,3 +701,13 @@ fn test_format_option() {
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_only("0.00\n0.10\n0.20\n0.30\n0.40\n0.50\n");
|
.stdout_only("0.00\n0.10\n0.20\n0.30\n0.40\n0.50\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_invalid_zero_increment_value() {
|
||||||
|
new_ucmd!()
|
||||||
|
.args(&["0", "0", "1"])
|
||||||
|
.fails()
|
||||||
|
.no_stdout()
|
||||||
|
.stderr_contains("invalid Zero increment value: '0'")
|
||||||
|
.stderr_contains("for more information.");
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue