mirror of
https://github.com/clap-rs/clap
synced 2024-12-15 15:22:30 +00:00
3923ebd86d
the test that was added tests for a panic that would occur when a global argument had a conflict with another argument that wasn't present in all the subcommands that the global argument was present in this would occur inside the get_arg_conflicts_with function
26 lines
827 B
Rust
26 lines
827 B
Rust
use clap::{App, Arg};
|
|
use clap_generate::{generate, generators::*};
|
|
use std::io;
|
|
|
|
#[test]
|
|
fn generate_completions() {
|
|
let mut app = App::new("test_app")
|
|
.arg(
|
|
Arg::new("config")
|
|
.short('c')
|
|
.conflicts_with("v")
|
|
.global(true),
|
|
)
|
|
.arg(Arg::new("v").short('v'))
|
|
.subcommand(
|
|
App::new("test")
|
|
.about("Subcommand")
|
|
.arg(Arg::new("debug").short('d')),
|
|
);
|
|
|
|
generate::<Bash, _>(&mut app, "test_app", &mut io::sink());
|
|
generate::<Fish, _>(&mut app, "test_app", &mut io::sink());
|
|
generate::<PowerShell, _>(&mut app, "test_app", &mut io::sink());
|
|
generate::<Elvish, _>(&mut app, "test_app", &mut io::sink());
|
|
generate::<Zsh, _>(&mut app, "test_app", &mut io::sink());
|
|
}
|