mirror of
https://github.com/clap-rs/clap
synced 2024-12-14 23:02:31 +00:00
tests(Suggestions): adds additional tests
This commit is contained in:
parent
7166f4f110
commit
8bcbce27f7
1 changed files with 20 additions and 1 deletions
|
@ -77,9 +77,28 @@ mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn did_you_mean_possible_values() {
|
fn possible_values_match() {
|
||||||
let p_vals = ["test", "possible", "values"];
|
let p_vals = ["test", "possible", "values"];
|
||||||
assert_eq!(did_you_mean("tst", p_vals.iter()), Some("test"));
|
assert_eq!(did_you_mean("tst", p_vals.iter()), Some("test"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn possible_values_nomatch() {
|
||||||
|
let p_vals = ["test", "possible", "values"];
|
||||||
assert!(did_you_mean("hahaahahah", p_vals.iter()).is_none());
|
assert!(did_you_mean("hahaahahah", p_vals.iter()).is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn suffix_long() {
|
||||||
|
let p_vals = ["test", "possible", "values"];
|
||||||
|
let suffix = "\n\tDid you mean \'--test\' ?";
|
||||||
|
assert_eq!(did_you_mean_suffix("tst", p_vals.iter(), DidYouMeanMessageStyle::LongFlag), (suffix, Some("test")));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn suffix_enum() {
|
||||||
|
let p_vals = ["test", "possible", "values"];
|
||||||
|
let suffix = "\n\tDid you mean \'test\' ?";
|
||||||
|
assert_eq!(did_you_mean_suffix("tst", p_vals.iter(), DidYouMeanMessageStyle::EnumValue), (suffix, Some("test")));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue