diff options
Diffstat (limited to 'cli/flags.rs')
-rw-r--r-- | cli/flags.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/cli/flags.rs b/cli/flags.rs index 537e768f2..b6e7abefb 100644 --- a/cli/flags.rs +++ b/cli/flags.rs @@ -3,6 +3,7 @@ use clap::App; use clap::AppSettings; use clap::Arg; use clap::ArgMatches; +use clap::ArgSettings; use clap::SubCommand; use log::Level; use std::net::SocketAddr; @@ -1191,6 +1192,7 @@ fn test_subcommand<'a, 'b>() -> App<'a, 'b> { ) .arg( Arg::with_name("filter") + .set(ArgSettings::AllowLeadingHyphen) .long("filter") .takes_value(true) .help("Run tests with this string or pattern in the test name"), @@ -2883,6 +2885,25 @@ mod tests { } #[test] + fn test_filter_leading_hyphen() { + let r = + flags_from_vec_safe(svec!["deno", "test", "--filter", "- foo", "dir1"]); + assert_eq!( + r.unwrap(), + Flags { + subcommand: DenoSubcommand::Test { + fail_fast: false, + allow_none: false, + quiet: false, + filter: Some("- foo".to_string()), + include: Some(svec!["dir1"]), + }, + ..Flags::default() + } + ); + } + + #[test] fn run_with_cafile() { let r = flags_from_vec_safe(svec![ "deno", |