1
0
Fork 0
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:
Jarrett Helton 2020-08-14 13:45:22 -04:00 committed by GitHub
parent 238816d62f
commit ac56512ba4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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![