clean up comments in tests; add error case test

This commit is contained in:
Will Murphy 2018-01-18 20:41:23 -05:00
parent 74976a0df9
commit c759d2027b

View file

@ -323,7 +323,6 @@ fn required_unless_one_2() {
#[test] #[test]
fn required_unless_one_works_with_short() { fn required_unless_one_works_with_short() {
// GitHub issue: https://github.com/kbknapp/clap-rs/issues/1135 // GitHub issue: https://github.com/kbknapp/clap-rs/issues/1135
// removing `short("x")` will make this test pass
let res = App::new("unlessone") let res = App::new("unlessone")
.arg(Arg::with_name("a").conflicts_with("b").short("a")) .arg(Arg::with_name("a").conflicts_with("b").short("a"))
.arg(Arg::with_name("b").short("b")) .arg(Arg::with_name("b").short("b"))
@ -336,10 +335,22 @@ fn required_unless_one_works_with_short() {
assert!(res.is_ok()); assert!(res.is_ok());
} }
#[test]
fn required_unless_one_works_with_short_err() {
let res = App::new("unlessone")
.arg(Arg::with_name("a").conflicts_with("b").short("a"))
.arg(Arg::with_name("b").short("b"))
.arg(
Arg::with_name("x")
.short("x")
.required_unless_one(&["a", "b"])
).get_matches_from_safe(vec!["unlessone"]);
assert!(!res.is_ok());
}
#[test] #[test]
fn required_unless_one_works_without() { fn required_unless_one_works_without() {
// GitHub issue: https://github.com/kbknapp/clap-rs/issues/1135
// removing `short("x")` will make this test pass
let res = App::new("unlessone") let res = App::new("unlessone")
.arg(Arg::with_name("a").conflicts_with("b").short("a")) .arg(Arg::with_name("a").conflicts_with("b").short("a"))
.arg(Arg::with_name("b").short("b")) .arg(Arg::with_name("b").short("b"))