diff --git a/tests/app_settings.rs b/tests/app_settings.rs index 74b1ae68..ccb9461c 100644 --- a/tests/app_settings.rs +++ b/tests/app_settings.rs @@ -223,7 +223,7 @@ fn delim_values_only_pos_follows() { let m = r.unwrap(); assert!(m.is_present("arg")); assert!(!m.is_present("f")); - assert_eq!(m.values_of("arg").unwrap().collect::>(), &["-f", "-g", "x"]); + assert_eq!(m.values_of("arg").unwrap().collect::>(), &["-f", "-g,x"]); } #[test] @@ -235,6 +235,31 @@ fn delim_values_trailingvararg() { ) .get_matches_from(vec!["", "test", "--foo", "-Wl,-bar"]); assert!(m.is_present("opt")); + assert_eq!(m.values_of("opt").unwrap().collect::>(), &["test", "--foo", "-Wl,-bar"]); +} + +#[test] +fn delim_values_only_pos_follows_with_delim() { + let r = App::new("onlypos") + .args(&[Arg::from_usage("-f [flag] 'some opt'"), + Arg::from_usage("[arg]... 'some arg'").use_delimiter(true)]) + .get_matches_from_safe(vec!["", "--", "-f", "-g,x"]); + assert!(r.is_ok()); + let m = r.unwrap(); + assert!(m.is_present("arg")); + assert!(!m.is_present("f")); + assert_eq!(m.values_of("arg").unwrap().collect::>(), &["-f", "-g", "x"]); +} + +#[test] +fn delim_values_trailingvararg_with_delim() { + let m = App::new("positional") + .setting(AppSettings::TrailingVarArg) + .arg( + Arg::from_usage("[opt]... 'some pos'").use_delimiter(true), + ) + .get_matches_from(vec!["", "test", "--foo", "-Wl,-bar"]); + assert!(m.is_present("opt")); assert_eq!(m.values_of("opt").unwrap().collect::>(), &["test", "--foo", "-Wl", "-bar"]); } diff --git a/tests/multiple_occurrences.rs b/tests/multiple_occurrences.rs index 6b31b732..9da337cf 100644 --- a/tests/multiple_occurrences.rs +++ b/tests/multiple_occurrences.rs @@ -5,7 +5,7 @@ use clap::{App, Arg}; #[test] fn multiple_occurrences_of_flags_long() { - let m = App::new("multiple_occurrences") + let m = App::new("mo_flags_long") .arg(Arg::from_usage("--multflag 'allowed multiple flag'") .multiple(true)) .arg(Arg::from_usage("--flag 'disallowed multiple flag'")) @@ -23,7 +23,7 @@ fn multiple_occurrences_of_flags_long() { #[test] fn multiple_occurrences_of_flags_short() { - let m = App::new("multiple_occurrences") + let m = App::new("mo_flags_short") .arg(Arg::from_usage("-m --multflag 'allowed multiple flag'") .multiple(true)) .arg(Arg::from_usage("-f --flag 'disallowed multiple flag'")) @@ -41,7 +41,7 @@ fn multiple_occurrences_of_flags_short() { #[test] fn multiple_occurrences_of_flags_mixed() { - let m = App::new("multiple_occurrences") + let m = App::new("mo_flags_mixed") .arg(Arg::from_usage("-m, --multflag1 'allowed multiple flag'") .multiple(true)) .arg(Arg::from_usage("-n, --multflag2 'another allowed multiple flag'") @@ -67,7 +67,7 @@ fn multiple_occurrences_of_flags_mixed() { #[test] fn multiple_occurrences_of_flags_large_quantity() { let args : Vec<&str> = vec![""].into_iter().chain(vec!["-m"; 1024].into_iter()).collect(); - let m = App::new("multiple_occurrences") + let m = App::new("mo_flags_larg_qty") .arg(Arg::from_usage("-m --multflag 'allowed multiple flag'") .multiple(true)) .get_matches_from(args); diff --git a/tests/multiple_values.rs b/tests/multiple_values.rs index 3941bf0a..194b8303 100644 --- a/tests/multiple_values.rs +++ b/tests/multiple_values.rs @@ -630,6 +630,7 @@ fn multiple_values_sep_positional() { let m = App::new("multiple_values") .arg(Arg::with_name("option") .help("multiple options") + .use_delimiter(true) .multiple(true)) .get_matches_from_safe(vec![ "",