mirror of
https://github.com/denoland/deno.git
synced 2025-01-14 01:50:19 -05:00
fix: Dash Value Treated As Arg (#7039)
This commit is contained in:
parent
238816d62f
commit
ac56512ba4
1 changed files with 21 additions and 0 deletions
21
cli/flags.rs
21
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"),
|
||||
|
@ -2882,6 +2884,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![
|
||||
|
|
Loading…
Reference in a new issue