Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uniq: use concat! in tests for better readability #6022

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 37 additions & 7 deletions tests/by-util/test_uniq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,10 @@ fn gnu_tests() {
args: &["-D", "-c"],
input: "", // Note: Different from GNU test, but should not matter
stdout: Some(""),
stderr: Some("uniq: printing all duplicated lines and repeat counts is meaningless\nTry 'uniq --help' for more information.\n"),
stderr: Some(concat!(
"uniq: printing all duplicated lines and repeat counts is meaningless\n",
"Try 'uniq --help' for more information.\n"
)),
exit: Some(1),
},
TestCase {
Expand Down Expand Up @@ -813,7 +816,14 @@ fn gnu_tests() {
args: &["--all-repeated=badoption"],
input: "", // Note: Different from GNU test, but should not matter
stdout: Some(""),
stderr: Some("uniq: invalid argument 'badoption' for '--all-repeated'\nValid arguments are:\n - 'none'\n - 'prepend'\n - 'separate'\nTry 'uniq --help' for more information.\n"),
stderr: Some(concat!(
"uniq: invalid argument 'badoption' for '--all-repeated'\n",
"Valid arguments are:\n",
" - 'none'\n",
" - 'prepend'\n",
" - 'separate'\n",
"Try 'uniq --help' for more information.\n"
)),
exit: Some(1),
},
// \x08 is the backspace char
Expand Down Expand Up @@ -984,39 +994,59 @@ fn gnu_tests() {
args: &["--group", "-c"],
input: "",
stdout: Some(""),
stderr: Some("uniq: --group is mutually exclusive with -c/-d/-D/-u\nTry 'uniq --help' for more information.\n"),
stderr: Some(concat!(
"uniq: --group is mutually exclusive with -c/-d/-D/-u\n",
"Try 'uniq --help' for more information.\n"
)),
exit: Some(1),
},
TestCase {
name: "142",
args: &["--group", "-d"],
input: "",
stdout: Some(""),
stderr: Some("uniq: --group is mutually exclusive with -c/-d/-D/-u\nTry 'uniq --help' for more information.\n"),
stderr: Some(concat!(
"uniq: --group is mutually exclusive with -c/-d/-D/-u\n",
"Try 'uniq --help' for more information.\n"
)),
exit: Some(1),
},
TestCase {
name: "143",
args: &["--group", "-u"],
input: "",
stdout: Some(""),
stderr: Some("uniq: --group is mutually exclusive with -c/-d/-D/-u\nTry 'uniq --help' for more information.\n"),
stderr: Some(concat!(
"uniq: --group is mutually exclusive with -c/-d/-D/-u\n",
"Try 'uniq --help' for more information.\n"
)),
exit: Some(1),
},
TestCase {
name: "144",
args: &["--group", "-D"],
input: "",
stdout: Some(""),
stderr: Some("uniq: --group is mutually exclusive with -c/-d/-D/-u\nTry 'uniq --help' for more information.\n"),
stderr: Some(concat!(
"uniq: --group is mutually exclusive with -c/-d/-D/-u\n",
"Try 'uniq --help' for more information.\n"
)),
exit: Some(1),
},
TestCase {
name: "145",
args: &["--group=badoption"],
input: "",
stdout: Some(""),
stderr: Some("uniq: invalid argument 'badoption' for '--group'\nValid arguments are:\n - 'prepend'\n - 'append'\n - 'separate'\n - 'both'\nTry 'uniq --help' for more information.\n"),
stderr: Some(concat!(
"uniq: invalid argument 'badoption' for '--group'\n",
"Valid arguments are:\n",
" - 'prepend'\n",
" - 'append'\n",
" - 'separate'\n",
" - 'both'\n",
"Try 'uniq --help' for more information.\n"
)),
exit: Some(1),
},
];
Expand Down
Loading