mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
seq: improve error handling for invalid -f values
Improve the error message produced by `seq` when given invalid format
specifiers for the `-f` option. Before this commit:
$ seq -f "%" 1
seq: %: invalid conversion specification
$ seq -f "%g%" 1
seq: %: invalid conversion specification
After this commit:
$ seq -f "%" 1
seq: format '%' ends in %
$ seq -f "%g%" 1
seq: format '%g%' has too many % directives
This matches the behavior of GNU `seq`.
This commit is contained in:
@@ -787,6 +787,16 @@ fn test_invalid_format() {
|
||||
.fails()
|
||||
.no_stdout()
|
||||
.stderr_contains("format '%g%g' has too many % directives");
|
||||
new_ucmd!()
|
||||
.args(&["-f", "%g%", "1"])
|
||||
.fails()
|
||||
.no_stdout()
|
||||
.stderr_contains("format '%g%' has too many % directives");
|
||||
new_ucmd!()
|
||||
.args(&["-f", "%", "1"])
|
||||
.fails()
|
||||
.no_stdout()
|
||||
.stderr_contains("format '%' ends in %");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user