mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 06:44:16 +00:00
test(complete): Ensure we infer path completions from value_parser
Looks like I forgot to add a test case for this. I put this in `clap_complete` because I expect `ValueHint` to move here as we move towards a plugin system. Fixes #3840
This commit is contained in:
parent
a7698e9a1d
commit
ea3bd55993
1 changed files with 11 additions and 0 deletions
11
clap_complete/tests/general.rs
Normal file
11
clap_complete/tests/general.rs
Normal file
|
@ -0,0 +1,11 @@
|
|||
#[test]
|
||||
fn infer_value_hint_for_path_buf() {
|
||||
let mut cmd = clap::Command::new("completer")
|
||||
.arg(clap::Arg::new("input").value_parser(clap::value_parser!(std::path::PathBuf)));
|
||||
cmd.build();
|
||||
let input = cmd
|
||||
.get_arguments()
|
||||
.find(|arg| arg.get_id() == "input")
|
||||
.unwrap();
|
||||
assert_eq!(input.get_value_hint(), clap::builder::ValueHint::AnyPath);
|
||||
}
|
Loading…
Reference in a new issue