diff --git a/src/help/mod.rs b/src/help/mod.rs index 43fc1e4..5feb3d9 100644 --- a/src/help/mod.rs +++ b/src/help/mod.rs @@ -970,7 +970,7 @@ mod tests_of_help { } #[test] - fn add_opts_with_margins_both_of_new_method_and_add_text_with_margins() { + fn add_opts_with_margins_by_constructor_and_add_text_with_margins() { use crate::OptCfgParam::*; let cols = linebreak::term_cols(); @@ -1160,14 +1160,17 @@ mod tests_of_help { let mut help = Help::new(); help.add_opts(&[ - OptCfg::with([names(&["foo-bar"]), desc("description")]), - OptCfg::with([names(&["*"]), desc("any option")]), + OptCfg::with([store_key("foo"), desc("description")]), + OptCfg::with([store_key("bar"), names(&["", ""]), desc("description")]), ]); let mut iter = help.iter(); let line = iter.next(); - assert_eq!(line, Some("--foo-bar description".to_string())); + assert_eq!(line, Some("--foo description".to_string())); + + let line = iter.next(); + assert_eq!(line, Some(" --bar description".to_string())); let line = iter.next(); assert_eq!(line, None); @@ -1212,7 +1215,7 @@ mod tests_of_help { } #[test] - fn add_text_with_indent_if_indent_is_longer_than_line_width() { + fn add_opts_with_indent_if_indent_is_longer_than_line_width() { use crate::OptCfgParam::*; let cols = linebreak::term_cols(); @@ -1236,7 +1239,7 @@ mod tests_of_help { } #[test] - fn add_text_with_margins_if_sum_of_margins_are_equal_to_line_width() { + fn add_opts_with_margins_if_sum_of_margins_are_equal_to_line_width() { use crate::OptCfgParam::*; let cols = linebreak::term_cols(); diff --git a/src/parse/parse_for.rs b/src/parse/parse_for.rs index d3799e0..e89a00d 100644 --- a/src/parse/parse_for.rs +++ b/src/parse/parse_for.rs @@ -924,7 +924,11 @@ mod tests_of_make_opt_cfgs_for { #[opt(cfg = "f64=7.89", desc = "The description of f64_val", arg = "")] f64_val: f64, - #[opt(cfg = "ss=[A,B,C]", desc = "The description of s_arr", arg = "")] + #[opt( + cfg = "ss=/[A,a/B,b/C,c]", + desc = "The description of s_arr", + arg = "" + )] s_arr: Vec, #[opt(cfg = "ii8=[-1,2,-3]", desc = "The description of i8_arr", arg = "")] @@ -1050,7 +1054,7 @@ mod tests_of_make_opt_cfgs_for { assert_eq!(store.f64_val, 7.89); assert_eq!( store.s_arr, - vec!["A".to_string(), "B".to_string(), "C".to_string()] + vec!["A,a".to_string(), "B,b".to_string(), "C,c".to_string()] ); assert_eq!(store.i8_arr, vec![-1, 2, -3]); assert_eq!(store.i16_arr, vec![2, -3, 4]); @@ -1218,7 +1222,11 @@ mod tests_of_make_opt_cfgs_for { assert_eq!(cfg.is_array, true); assert_eq!( cfg.defaults, - Some(vec!["A".to_string(), "B".to_string(), "C".to_string()]) + Some(vec![ + "A,a".to_string(), + "B,b".to_string(), + "C,c".to_string() + ]) ); assert_eq!(cfg.desc, "The description of s_arr".to_string()); assert_eq!(cfg.arg_in_help, "".to_string()); diff --git a/tests/help_test.rs b/tests/help_test.rs index 5230de1..7ed741f 100644 --- a/tests/help_test.rs +++ b/tests/help_test.rs @@ -23,7 +23,6 @@ mod tests_of_print_help { store_key("fail"), names(&["f", "fail"]), desc("Fail fast with no output on HTTP errors"), - arg_in_help(""), ]), cliargs::OptCfg::with([ store_key("help"),