mirror of
https://github.com/clap-rs/clap
synced 2025-03-02 14:27:28 +00:00
test(asserts): Add test for self requires
Add a test that shows that clap doesn't complain when a flag requires itself. This test demonstrates existing broken behavior, ideally it should panic. It will be fixed in the next commit. Signed-off-by: Omer Tuchfeld <omer@tuchfeld.dev>
This commit is contained in:
parent
bfca193556
commit
52aad0ea1a
1 changed files with 9 additions and 0 deletions
|
@ -1478,3 +1478,12 @@ For more information, try '--help'.
|
|||
";
|
||||
utils::assert_output(cmd, "test --require-first --second", EXPECTED, true);
|
||||
}
|
||||
|
||||
#[test]
|
||||
/// This test demonstrates existing broken behavior, ideally it should panic
|
||||
fn requires_self() {
|
||||
let result = Command::new("flag_required")
|
||||
.arg(arg!(-f --flag "some flag").requires("flag"))
|
||||
.try_get_matches_from(vec![""]);
|
||||
assert!(result.is_ok());
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue