mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 23:04:23 +00:00
clean up comments in tests; add error case test
This commit is contained in:
parent
74976a0df9
commit
c759d2027b
1 changed files with 14 additions and 3 deletions
|
@ -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"))
|
||||||
|
|
Loading…
Reference in a new issue