Commit graph

13 commits

Author SHA1 Message Date
Kevin K
7ac5a5af9f tests: cleans up certain test cases litle by little 2018-01-09 10:53:20 -05:00
Kevin K
8c0cc5c386
style: rustfmt run 2017-11-28 08:57:04 -05:00
Kevin K
612ccaf14e
tests: adds tests for using possible_values with Arg::case_insensitive 2017-11-28 08:57:04 -05:00
Kevin K
80993357e1
api: Adds Arg::case_insensitive(bool) which allows matching Arg::possible_values without worrying about ASCII case
When used with `Arg::possible_values` it allows the argument value to pass validation even if
the case differs from that of the specified `possible_value`.

```rust
let m = App::new("pv")
    .arg(Arg::with_name("option")
        .long("--option")
        .takes_value(true)
        .possible_value("test123")
        .case_insensitive(true))
    .get_matches_from(vec![
        "pv", "--option", "TeSt123",
    ]);

assert!(m.value_of("option").unwrap().eq_ignore_ascii_case("test123"));
```

This setting also works when multiple values can be defined:

```rust
let m = App::new("pv")
    .arg(Arg::with_name("option")
        .short("-o")
        .long("--option")
        .takes_value(true)
        .possible_value("test123")
        .possible_value("test321")
        .multiple(true)
        .case_insensitive(true))
    .get_matches_from(vec![
        "pv", "--option", "TeSt123", "teST123", "tESt321"
    ]);

let matched_vals = m.values_of("option").unwrap().collect::<Vec<_>>();
assert_eq!(&*matched_vals, &["TeSt123", "teST123", "tESt321"]);
```

Closes #1118
2017-11-28 08:57:04 -05:00
Kevin K
f967235a90
tests: massively rehauls tests for better debugging and vastly improved error messages/deduplication 2017-01-02 23:05:50 -05:00
tormol
996fc38176 docs: fix tests that fail when the "suggestions" feature is disabled 2016-10-16 11:31:12 +02:00
Bence Szigeti
f8ca3085da Fix: typo -- missing space and commas 2016-07-05 22:14:47 +02:00
Bence Szigeti
8d7bea823f Fix: extra space typo removed 2016-07-05 22:01:04 +02:00
Kevin K
b42ca0b5ab chore(Tests): had to remove external clap-test crate...sad face 2016-05-09 22:46:09 -04:00
Kevin K
852e58156c tests: removes old python tests and replaces with rust tests
Closes #166
2016-05-09 19:14:11 -04:00
Kevin K
0031d78564 refactor(v2): improving macros for code dedup 2016-01-28 11:45:31 -05:00
Kevin K
7fc18e685f test(v2): fixing tests to pass under new v2 changes 2016-01-28 11:45:31 -05:00
Sung Rim Huh
1c41d1bf43 tests(possible_values): add tests for possible values 2016-01-13 08:52:42 -08:00