diff --git a/tests/groups.rs b/tests/groups.rs
index 232aa51ca319..12a2804531a2 100644
--- a/tests/groups.rs
+++ b/tests/groups.rs
@@ -11,15 +11,7 @@ USAGE:
For more information try --help";
static REQ_GROUP_CONFLICT_USAGE: &str =
- "error: The argument '' cannot be used with '--delete'
-
-USAGE:
- clap-test
-
-For more information try --help";
-
-#[allow(unused)]
-static REQ_GROUP_CONFLICT_REV: &str = "error: The argument '--delete' cannot be used with ''
+ "error: The argument '--delete' cannot be used with ''
USAGE:
clap-test
@@ -27,22 +19,10 @@ USAGE:
For more information try --help";
static REQ_GROUP_CONFLICT_ONLY_OPTIONS: &str =
- "error: Found argument '--all' which wasn't expected, or isn't valid in this context
-
-\tIf you tried to supply `--all` as a value rather than a flag, use `-- --all`
-
-USAGE:
- clap-test <-a|--delete>
-
-For more information try --help";
-
-// FIXME: This message has regressed after https://github.com/clap-rs/clap/pull/1856
-// Need to roll back somehow.
-static REQ_GROUP_CONFLICT_REV_DEGRADED: &str =
- "error: Found argument 'base' which wasn't expected, or isn't valid in this context
+ "error: The argument '--delete' cannot be used with '--all'
USAGE:
- clap-test
+ clap-test <--all|--delete>
For more information try --help";
@@ -214,10 +194,9 @@ fn req_group_with_conflict_usage_string() {
.required(true),
);
- assert!(utils::compare_output2(
+ assert!(utils::compare_output(
app,
"clap-test --delete base",
- REQ_GROUP_CONFLICT_REV_DEGRADED,
REQ_GROUP_CONFLICT_USAGE,
true
));
@@ -226,7 +205,7 @@ fn req_group_with_conflict_usage_string() {
#[test]
fn req_group_with_conflict_usage_string_only_options() {
let app = App::new("req_group")
- .arg(Arg::from(" -a, -all 'All'").conflicts_with("delete"))
+ .arg(Arg::from(" -a --all 'All'").conflicts_with("delete"))
.arg(Arg::from(
" -d, --delete 'Remove the base commit information'",
))
@@ -235,11 +214,10 @@ fn req_group_with_conflict_usage_string_only_options() {
.args(&["all", "delete"])
.required(true),
);
- assert!(utils::compare_output2(
+ assert!(utils::compare_output(
app,
"clap-test --delete --all",
REQ_GROUP_CONFLICT_ONLY_OPTIONS,
- REQ_GROUP_CONFLICT_USAGE,
true
));
}
diff --git a/tests/utils.rs b/tests/utils.rs
index 3c6473124a42..947515cf2eec 100644
--- a/tests/utils.rs
+++ b/tests/utils.rs
@@ -47,23 +47,6 @@ pub fn compare_output(l: App, args: &str, right: &str, stderr: bool) -> bool {
compare(left, right)
}
-pub fn compare_output2(l: App, args: &str, right1: &str, right2: &str, stderr: bool) -> bool {
- let mut buf = Cursor::new(Vec::with_capacity(50));
- let res = l.try_get_matches_from(args.split(' ').collect::>());
- let err = res.unwrap_err();
- write!(&mut buf, "{}", err).unwrap();
- let content = buf.into_inner();
- let left = String::from_utf8(content).unwrap();
- assert_eq!(
- stderr,
- err.use_stderr(),
- "Should Use STDERR failed. Should be {} but is {}",
- stderr,
- err.use_stderr()
- );
- compare(&*left, right1) || compare(&*left, right2)
-}
-
// Legacy tests from the python script days
pub fn complex_app() -> App<'static> {