nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: clap-rs/clap
Pull request #1932 (2020-05-15 16:10:02)

fix(errors): ensure that validation failure error message includes a newline
also add a basic test of a failed validation

pmarks: @CreepySkeleton  @pksunkara  how about this?
pksunkara: Looks good. Just few formatting issues. Please address them and squash the commits.

Patch:
diff --git a/src/parse/errors.rs b/src/parse/errors.rs
index 8da0bf87..ace794c8 100644
--- a/src/parse/errors.rs
+++ b/src/parse/errors.rs
@@ -851,6 +851,7 @@ impl Error {
         }
 
         c.none(&format!(": {}", err))?;
+        try_help(&mut c)?;
 
         Ok(Error {
             cause: format!(


Test patch:
diff --git a/tests/validators.rs b/tests/validators.rs
index 31e7186d..8914eefc 100644
--- a/tests/validators.rs
+++ b/tests/validators.rs
@@ -17,3 +17,22 @@ fn both_validator_and_validator_os() {
         )
         .try_get_matches_from(&["app", "1"]);
 }
+
+#[test]
+fn test_validator_msg_newline() {
+    let res = App::new("test")
+        .arg(Arg::new("test").validator(|val| val.parse::<u32>().map_err(|e| e.to_string())))
+        .try_get_matches_from(&["app", "f"]);
+
+    assert!(res.is_err());
+    let err = res.unwrap_err();
+
+    assert_eq!(
+        err.cause,
+        "Invalid value for \'<test>\': invalid digit found in string"
+    );
+
+    // This message is the only thing that gets printed -- make sure it ends with a newline
+    let msg = format!("{}", err);
+    assert!(msg.ends_with('\n'));
+}
Repository: clap-rs/clap
Pull request #1983 (2020-06-25 11:53:51)

Fix the external command subtype check
And update the related test accordingly.



Patch:
diff --git a/clap_derive/src/derives/subcommand.rs b/clap_derive/src/derives/subcommand.rs
index 40e6ce45..ba4192b2 100644
--- a/clap_derive/src/derives/subcommand.rs
+++ b/clap_derive/src/derives/subcommand.rs
@@ -188,12 +188,18 @@ fn gen_from_subcommand(
                                 quote!(::std::string::String),
                                 quote!(values_of),
                             )
-                        } else {
+                        } else if is_simple_ty(subty, "OsString") {
                             (
                                 subty.span(),
                                 quote!(::std::ffi::OsString),
                                 quote!(values_of_os),
                             )
+                        } else {
+                            abort!(
+                                ty.span(),
+                                "The type must be either `Vec<String>` or `Vec<OsString>` \
+                                 to be used with `external_subcommand`."
+                            );
                         }
                     }
 


Test patch:
diff --git a/clap_derive/tests/ui/external_subcommand_wrong_type.stderr b/clap_derive/tests/ui/external_subcommand_wrong_type.stderr
index d4ff9026..21d1bb37 100644
--- a/clap_derive/tests/ui/external_subcommand_wrong_type.stderr
+++ b/clap_derive/tests/ui/external_subcommand_wrong_type.stderr
@@ -1,3 +1,9 @@
+error: The type must be either `Vec<String>` or `Vec<OsString>` to be used with `external_subcommand`.
+ --> $DIR/external_subcommand_wrong_type.rs:7:11
+  |
+7 |     Other(Vec<CString>),
+  |           ^^^
+
 error: The type must be either `Vec<String>` or `Vec<OsString>` to be used with `external_subcommand`.
   --> $DIR/external_subcommand_wrong_type.rs:13:11
    |
@@ -10,12 +16,3 @@ error: The enum variant marked with `external_attribute` must be a single-typed
 18 | /     #[clap(external_subcommand)]
 19 | |     Other { a: String },
    | |_______________________^
-
-error[E0308]: mismatched types
- --> $DIR/external_subcommand_wrong_type.rs:7:15
-  |
-7 |     Other(Vec<CString>),
-  |               ^^^^^^^ expected struct `std::ffi::CString`, found struct `std::ffi::OsString`
-  |
-  = note: expected struct `std::vec::Vec<std::ffi::CString>`
-             found struct `std::vec::Vec<std::ffi::OsString>`
Repository: clap-rs/clap
Pull request #1992 (2020-06-29 14:44:29)

fix(clap_derive): Unwrap `syn::TypeGroup` when checking field types
Due to macro expansions, a `syn` type may be wrapped in multiple
'layers' of `syn::Type::Group`. However, `clap_derive` currently does
not check for `syn::Type::Group`, which will cause an `Option` (along
with other matched types) to fail to be detected when it results from a
macro expansion.

This commit 'unwraps' outer type groups before checking the
user-provided types against well-known types. Currently, these groups
may not be present due to a rustc bug (rust-lang/rust#43081)

However, once https://github.com/rust-lang/rust/pull/73084 is merged,
these groups will be present in more cases. This commit makes `clap`
compatible with both older and newer versions of rustc.

<!--
If your PR closes some issues, please write `Closes #XXXX`
where `XXXX` is the number of the issue you want to fix.
Each issue goes on it's own line.
-->



Patch:
diff --git a/clap_derive/src/utils/ty.rs b/clap_derive/src/utils/ty.rs
index c2cec83f..e180758e 100644
--- a/clap_derive/src/utils/ty.rs
+++ b/clap_derive/src/utils/ty.rs
@@ -44,7 +44,10 @@ pub fn sub_type(ty: &syn::Type) -> Option<&syn::Type> {
     subty_if(ty, |_| true)
 }
 
-fn only_last_segment(ty: &syn::Type) -> Option<&PathSegment> {
+fn only_last_segment(mut ty: &syn::Type) -> Option<&PathSegment> {
+    while let syn::Type::Group(syn::TypeGroup { elem, .. }) = ty {
+        ty = elem;
+    }
     match ty {
         Type::Path(TypePath {
             qself: None,


Test patch:
diff --git a/clap_derive/tests/nested.rs b/clap_derive/tests/nested.rs
new file mode 100644
index 00000000..1642aba0
--- /dev/null
+++ b/clap_derive/tests/nested.rs
@@ -0,0 +1,33 @@
+// Copyright 2018 Guillaume Pinot (@TeXitoi) <texitoi@texitoi.eu>,
+// Kevin Knapp (@kbknapp) <kbknapp@gmail.com>, and
+// Andrew Hobden (@hoverbear) <andrew@hoverbear.org>
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+//
+// This work was derived from Structopt (https://github.com/TeXitoi/structopt)
+// commit#ea76fa1b1b273e65e3b0b1046643715b49bec51f which is licensed under the
+// MIT/Apache 2.0 license.
+
+use clap::Clap;
+
+// Tests that clap_derive properly detects an `Option` field
+// that results from a macro expansion
+#[test]
+fn use_option() {
+    macro_rules! expand_ty {
+        ($name:ident: $ty:ty) => {
+            #[derive(Clap)]
+            struct Outer {
+                #[clap(short, long)]
+                #[allow(dead_code)]
+                $name: $ty,
+            }
+        };
+    }
+
+    expand_ty!(my_field: Option<String>);
+}
Repository: clap-rs/clap
Pull request #2010 (2020-07-13 12:35:20)

feat(macros): Add `@global $setting` to set global settings
This PR adds the ability to set global settings with `@global $setting` just like `@setting`.
```rust
let app = clap_app!(claptest =>
    (@global ColorNever)
    (@global DisableVersion)
);
```
instead of
```rust
let app = clap_app!(claptest =>
    (global_setting: AppSettings::ColorNever)
    (global_setting: AppSettings::DisableVersion)
);
```

I also added the attributes to the basic macro test.

CreepySkeleton: I would be in favor of `@global_setting`, but I'm against `@global`. What does "global" mean? Global argument or global setting? That's unclear from reader's perspective.

Patch:
diff --git a/src/macros.rs b/src/macros.rs
index a59d803b..54e6e293 100644
--- a/src/macros.rs
+++ b/src/macros.rs
@@ -312,6 +312,13 @@ macro_rules! clap_app {
             $($tt)*
         }
     };
+    // Global Settings
+    (@app ($builder:expr) (@global_setting $setting:ident) $($tt:tt)*) => {
+        $crate::clap_app!{ @app
+            ($builder.global_setting($crate::AppSettings::$setting))
+            $($tt)*
+        }
+    };
     // Settings
     (@app ($builder:expr) (@setting $setting:ident) $($tt:tt)*) => {
         $crate::clap_app!{ @app


Test patch:
diff --git a/tests/macros.rs b/tests/macros.rs
old mode 100755
new mode 100644
index 32cad5de..9404b2e1
--- a/tests/macros.rs
+++ b/tests/macros.rs
@@ -28,6 +28,8 @@ fn basic() {
         (version: "0.1")
         (about: "tests clap library")
         (author: "Kevin K. <kbknapp@gmail.com>")
+        (@global_setting ColorNever)
+        (@setting VersionlessSubcommands)
         (@arg opt: -o --option +takes_value ... "tests options")
         (@arg positional: index(1) "tests positionals")
         (@arg flag: -f --flag ... +global "tests flags")
Repository: clap-rs/clap
Pull request #2415 (2021-03-14 01:35:57)

Ignore extra fields in Arg yaml definitions
Closes #2413 

When loading a `yaml` file, the presence of any extra fields in any of the `Arg`s causes the program to panic. Extra fields at the `App` level are ignored without consequence. This pull request changes the behavior of extra fields at the `Arg` level to match the `App` level, extra fields at both levels will be ignored when loading a `yaml` config.

This pull request also updates `tests/fixtures/app.yaml` with examples of ignored fields for both `App` and `Arg`s. This is checked by the `create_app_from_yaml` test in `tests/yaml.rs`.


Patch:
diff --git a/src/build/arg/mod.rs b/src/build/arg/mod.rs
index 38f4e4c4..69cb27bf 100644
--- a/src/build/arg/mod.rs
+++ b/src/build/arg/mod.rs
@@ -4712,10 +4712,7 @@ impl<'help> From<&'help Yaml> for Arg<'help> {
                         panic!("Failed to convert YAML value to vector")
                     }
                 }
-                s => panic!(
-                    "Unknown Arg setting '{}' in YAML file for arg '{}'",
-                    s, name_str
-                ),
+                _ => continue, // Ignore extra fields
             }
         }
 


Test patch:
diff --git a/tests/fixtures/app.yaml b/tests/fixtures/app.yaml
index 4d70bd43..15f955f8 100644
--- a/tests/fixtures/app.yaml
+++ b/tests/fixtures/app.yaml
@@ -4,11 +4,13 @@ about: tests clap library
 author: Kevin K. <kbknapp@gmail.com>
 settings:
     - ArgRequiredElseHelp
+ignored_field: This field is ignored
 args:
     - help:
         short: h
         long: help
         about: prints help with a nonstandard description
+        ignored_field: This field is ignored
     - option:
         short: o
         long: option
Repository: clap-rs/clap
Pull request #2227 (2020-11-27 20:21:23)

Changing grammar for error message
I found the original grammar awkward. Hopefully the change makes the error slightly clearer. 


Patch:
diff --git a/src/parse/parser.rs b/src/parse/parser.rs
index 64007df1..bc46cdaf 100644
--- a/src/parse/parser.rs
+++ b/src/parse/parser.rs
@@ -220,7 +220,7 @@ impl<'help, 'app> Parser<'help, 'app> {
                 if foundx2 && !p.is_set(ArgSettings::Required) {
                     assert!(
                         p.is_set(ArgSettings::Required),
-                        "Found positional argument which is not required with a lower \
+                        "Found non-required positional argument with a lower \
                          index than a required positional argument by two or more: {:?} \
                          index {:?}",
                         p.name,
@@ -254,7 +254,7 @@ impl<'help, 'app> Parser<'help, 'app> {
                 if found {
                     assert!(
                         p.is_set(ArgSettings::Required),
-                        "Found positional argument which is not required with a lower \
+                        "Found non-required positional argument with a lower \
                          index than a required positional argument: {:?} index {:?}",
                         p.name,
                         p.index


Test patch:
diff --git a/tests/positionals.rs b/tests/positionals.rs
index bfe4387b..305a7990 100644
--- a/tests/positionals.rs
+++ b/tests/positionals.rs
@@ -217,7 +217,7 @@ fn single_positional_required_usage_string() {
 // This tests a programmer error and will only succeed with debug_assertions
 #[cfg(debug_assertions)]
 #[test]
-#[should_panic = "Found positional argument which is not required \
+#[should_panic = "Found non-required positional argument \
 with a lower index than a required positional argument"]
 fn missing_required() {
     let _ = App::new("test")
Repository: clap-rs/clap
Pull request #2306 (2021-01-22 08:05:42)

Fix unset_setting()
`unset_setting()` accidentally changes global setting, which makes it's behaviour the same as `unset_global_setting`. This PR fixes it. 


Patch:
diff --git a/src/build/app/mod.rs b/src/build/app/mod.rs
index 342746b2..f97f64ca 100644
--- a/src/build/app/mod.rs
+++ b/src/build/app/mod.rs
@@ -947,7 +947,6 @@ impl<'help> App<'help> {
     #[inline]
     pub fn unset_setting(mut self, setting: AppSettings) -> Self {
         self.settings.unset(setting);
-        self.g_settings.unset(setting);
         self
     }
 


Test patch:
diff --git a/tests/app_settings.rs b/tests/app_settings.rs
index ef469459..b971ad19 100644
--- a/tests/app_settings.rs
+++ b/tests/app_settings.rs
@@ -542,8 +542,8 @@ fn unset_settings() {
     assert!(&m.is_set(AppSettings::ColorAuto));
 
     let m = m
-        .unset_setting(AppSettings::AllowInvalidUtf8)
-        .unset_setting(AppSettings::ColorAuto);
+        .unset_global_setting(AppSettings::AllowInvalidUtf8)
+        .unset_global_setting(AppSettings::ColorAuto);
     assert!(!m.is_set(AppSettings::AllowInvalidUtf8), "{:#?}", m);
     assert!(!m.is_set(AppSettings::ColorAuto), "{:#?}", m);
 }
Repository: clap-rs/clap
Pull request #3142 (2021-12-10 12:41:39)

Fix unqualified result types causing compilation failures with derive implementations
Fixes some additional unqualified types in the derive macros and adds a regression test case.


Patch:
diff --git a/clap_derive/src/derives/args.rs b/clap_derive/src/derives/args.rs
index 016a3d8f..2842b9ba 100644
--- a/clap_derive/src/derives/args.rs
+++ b/clap_derive/src/derives/args.rs
@@ -602,7 +602,7 @@ fn gen_parsers(
         Ty::OptionVec => quote_spanned! { ty.span()=>
             if #arg_matches.is_present(#name) {
                 Some(#arg_matches.#values_of(#name)
-                    .map(|v| v.map::<Result<#convert_type, clap::Error>, _>(#parse).collect::<Result<Vec<_>, clap::Error>>())
+                    .map(|v| v.map::<::std::result::Result<#convert_type, clap::Error>, _>(#parse).collect::<::std::result::Result<Vec<_>, clap::Error>>())
                     .transpose()?
                     .unwrap_or_else(Vec::new))
             } else {
@@ -613,7 +613,7 @@ fn gen_parsers(
         Ty::Vec => {
             quote_spanned! { ty.span()=>
                 #arg_matches.#values_of(#name)
-                    .map(|v| v.map::<Result<#convert_type, clap::Error>, _>(#parse).collect::<Result<Vec<_>, clap::Error>>())
+                    .map(|v| v.map::<::std::result::Result<#convert_type, clap::Error>, _>(#parse).collect::<::std::result::Result<Vec<_>, clap::Error>>())
                     .transpose()?
                     .unwrap_or_else(Vec::new)
             }


Test patch:
diff --git a/tests/derive/main.rs b/tests/derive/main.rs
index 0ef1ee45..33ce6715 100644
--- a/tests/derive/main.rs
+++ b/tests/derive/main.rs
@@ -28,5 +28,6 @@ mod rename_all_env;
 mod skip;
 mod structopt;
 mod subcommands;
+mod type_alias_regressions;
 mod utf8;
 mod utils;
diff --git a/tests/derive/type_alias_regressions.rs b/tests/derive/type_alias_regressions.rs
new file mode 100644
index 00000000..16670587
--- /dev/null
+++ b/tests/derive/type_alias_regressions.rs
@@ -0,0 +1,31 @@
+/// Regression test to ensure that type aliases do not cause compilation failures.
+use clap::Parser;
+use std::str::FromStr;
+
+// Result type alias
+#[allow(dead_code)]
+type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;
+
+// Wrapper to use for Option type alias
+struct Wrapper<T>(T);
+
+impl<T: FromStr> FromStr for Wrapper<T> {
+    type Err = <T as FromStr>::Err;
+
+    fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
+        T::from_str(s).map(Wrapper)
+    }
+}
+
+type Option<T> = std::option::Option<Wrapper<T>>;
+
+#[derive(Parser)]
+pub struct Opts {
+    another_string: Option<String>,
+    strings: Vec<String>,
+}
+
+#[test]
+fn type_alias_regressions() {
+    Opts::parse();
+}
Repository: clap-rs/clap
Pull request #3144 (2021-12-10 16:43:17)

fix(derive): Allow aliased Option with ArgEnum
My goal was just to expand the tests from #3142 to cover the basic derives but apparently, I found another case to qualify.


Patch:
diff --git a/clap_derive/src/derives/arg_enum.rs b/clap_derive/src/derives/arg_enum.rs
index 61f99821..045a0af7 100644
--- a/clap_derive/src/derives/arg_enum.rs
+++ b/clap_derive/src/derives/arg_enum.rs
@@ -114,7 +114,7 @@ fn gen_to_possible_value(lits: &[(TokenStream, Ident)]) -> TokenStream {
     let (lit, variant): (Vec<TokenStream>, Vec<Ident>) = lits.iter().cloned().unzip();
 
     quote! {
-        fn to_possible_value<'a>(&self) -> Option<clap::PossibleValue<'a>> {
+        fn to_possible_value<'a>(&self) -> ::std::option::Option<clap::PossibleValue<'a>> {
             match self {
                 #(Self::#variant => Some(#lit),)*
                 _ => None


Test patch:
diff --git a/tests/derive/type_alias_regressions.rs b/tests/derive/type_alias_regressions.rs
index 16670587..1c70936b 100644
--- a/tests/derive/type_alias_regressions.rs
+++ b/tests/derive/type_alias_regressions.rs
@@ -1,12 +1,14 @@
 /// Regression test to ensure that type aliases do not cause compilation failures.
-use clap::Parser;
 use std::str::FromStr;
 
+use clap::{ArgEnum, Parser, Subcommand};
+
 // Result type alias
 #[allow(dead_code)]
 type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;
 
 // Wrapper to use for Option type alias
+#[derive(Debug, PartialEq, Eq)]
 struct Wrapper<T>(T);
 
 impl<T: FromStr> FromStr for Wrapper<T> {
@@ -21,11 +23,25 @@ type Option<T> = std::option::Option<Wrapper<T>>;
 
 #[derive(Parser)]
 pub struct Opts {
-    another_string: Option<String>,
-    strings: Vec<String>,
+    another_string: String,
+    #[clap(subcommand)]
+    command: Command,
+    #[clap(short, long, arg_enum)]
+    choice: ArgChoice,
+}
+
+#[derive(Subcommand, PartialEq, Debug)]
+enum Command {
+    DoSomething { arg: Option<String> },
+}
+
+#[derive(ArgEnum, PartialEq, Debug, Clone)]
+enum ArgChoice {
+    Foo,
+    Bar,
 }
 
 #[test]
 fn type_alias_regressions() {
-    Opts::parse();
+    Opts::try_parse_from(["test", "value", "--choice=foo", "do-something"]).unwrap();
 }
Repository: clap-rs/clap
Pull request #3195 (2021-12-17 15:23:18)

docs: More explicit "derive" feature


Patch:
diff --git a/Cargo.toml b/Cargo.toml
index b46151df..6883eebd 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -49,6 +49,7 @@ pre-release-replacements = [
   {file="CHANGELOG.md", search="<!-- next-header -->", replace="<!-- next-header -->\n## [Unreleased] - ReleaseDate\n", exactly=1},
   {file="CHANGELOG.md", search="<!-- next-url -->", replace="<!-- next-url -->\n[Unreleased]: https://github.com/clap-rs/clap/compare/{{tag_name}}...HEAD", exactly=1},
   {file="README.md", search="github.com/clap-rs/clap/blob/[^/]+/", replace="github.com/clap-rs/clap/blob/{{tag_name}}/", exactly=9, prerelease = true},
+  {file="README.md", search="version = \"[a-z0-9\\.-]+\"", replace="version = \"{{version}}\"", exactly=1},
 ]
 
 [features]
diff --git a/README.md b/README.md
index 3f95fb0f..0bc9d423 100644
--- a/README.md
+++ b/README.md
@@ -56,7 +56,11 @@ fn main() {
     }
 }
 ```
-*(note: requires feature `derive`)*
+Add this to `Cargo.toml`:
+```toml
+[dependencies]
+clap = { version = "3.0.0-rc.7", features = ["derive"] }
+```
 ```bash
 $ demo --help
 clap [..]
diff --git a/src/parse/parser.rs b/src/parse/parser.rs
index dcf9e4a0..847630c5 100644
--- a/src/parse/parser.rs
+++ b/src/parse/parser.rs
@@ -1072,12 +1072,11 @@ impl<'help, 'app> Parser<'help, 'app> {
                 || v.is_set(ArgSettings::HiddenShortHelp)
         };
 
-        // Subcommands aren't checked because we prefer short help for them, deferring to
-        // `cmd subcmd --help` for more.
         self.app.long_about.is_some()
             || self.app.before_long_help.is_some()
             || self.app.after_long_help.is_some()
             || self.app.args.args().any(should_long)
+            || self.app.subcommands.iter().any(|s| s.long_about.is_some())
     }
 
     fn parse_long_arg(


Test patch:
diff --git a/tests/builder/help.rs b/tests/builder/help.rs
index 2e3d111a..d8965178 100644
--- a/tests/builder/help.rs
+++ b/tests/builder/help.rs
@@ -597,11 +597,14 @@ USAGE:
     about-in-subcommands-list [SUBCOMMAND]
 
 OPTIONS:
-    -h, --help    Print help information
+    -h, --help
+            Print help information
 
 SUBCOMMANDS:
-    help    Print this message or the help of the given subcommand(s)
-    sub     short about sub
+    help
+            Print this message or the help of the given subcommand(s)
+    sub
+            short about sub
 ";
 
 fn setup() -> App<'static> {
@@ -2278,7 +2281,7 @@ fn option_usage_order() {
 }
 
 #[test]
-fn prefer_about_over_long_about_in_subcommands_list() {
+fn about_in_subcommands_list() {
     let app = App::new("about-in-subcommands-list").subcommand(
         App::new("sub")
             .long_about("long about sub")
Repository: clap-rs/clap
Pull request #3205 (2021-12-22 02:41:53)

fix: Ensure we validate required-unless
Found this when digging into #3197


Patch:
diff --git a/src/parse/validator.rs b/src/parse/validator.rs
index f6e25945..ae62c5ef 100644
--- a/src/parse/validator.rs
+++ b/src/parse/validator.rs
@@ -37,6 +37,7 @@ impl<'help, 'app, 'parser> Validator<'help, 'app, 'parser> {
         if let ParseState::Opt(a) = parse_state {
             debug!("Validator::validate: needs_val_of={:?}", a);
             self.validate_required(matcher)?;
+            self.validate_required_unless(matcher)?;
 
             let o = &self.p.app[&a];
             reqs_validated = true;


Test patch:
diff --git a/tests/builder/require.rs b/tests/builder/require.rs
index e0f6c4cc..99439896 100644
--- a/tests/builder/require.rs
+++ b/tests/builder/require.rs
@@ -258,6 +258,23 @@ fn required_unless_err() {
     assert_eq!(res.unwrap_err().kind, ErrorKind::MissingRequiredArgument);
 }
 
+#[test]
+fn required_unless_present_with_optional_value() {
+    let res = App::new("unlesstest")
+        .arg(Arg::new("opt").long("opt").min_values(0).max_values(1))
+        .arg(
+            Arg::new("cfg")
+                .required_unless_present("dbg")
+                .takes_value(true)
+                .long("config"),
+        )
+        .arg(Arg::new("dbg").long("debug"))
+        .try_get_matches_from(vec!["unlesstest", "--opt"]);
+
+    assert!(res.is_err());
+    assert_eq!(res.unwrap_err().kind, ErrorKind::MissingRequiredArgument);
+}
+
 // REQUIRED_UNLESS_ALL
 
 #[test]