Skip to content

Commit

Permalink
add failing test for trailing varargs with comma
Browse files Browse the repository at this point in the history
luser committed May 22, 2016
1 parent a86d6aa commit ad9f8d8
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/positionals.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
extern crate clap;

use clap::{App, Arg, ErrorKind};
use clap::{App, AppSettings, Arg, ErrorKind};

#[test]
fn only_pos_follow() {
@@ -176,3 +176,15 @@ fn default_values_user_value() {
assert!(m.is_present("arg"));
assert_eq!(m.value_of("arg").unwrap(), "value");
}

#[test]
fn positional_trailingvararg() {
let m = App::new("positional")
.setting(AppSettings::TrailingVarArg)
.arg(
Arg::from_usage("[opt]... 'some pos'"),
)
.get_matches_from(vec!["", "test", "--foo", "-Wl,-bar"]);
assert!(m.is_present("opt"));
assert_eq!(m.values_of("opt").unwrap().collect::<Vec<_>>(), &["test", "--foo", "-Wl,-bar"]);
}

0 comments on commit ad9f8d8

Please sign in to comment.