()
| 925 | |
| 926 | #[test] |
| 927 | fn test_help_prefix_search() { |
| 928 | fn exp_output(name: &str, is_function: bool) -> Vec<CapturedOut> { |
| 929 | let spec = if is_function { |
| 930 | format!(" {}(sample$)", name) |
| 931 | } else { |
| 932 | format!(" {} sample$", name) |
| 933 | }; |
| 934 | vec![ |
| 935 | CapturedOut::Print("".to_owned()), |
| 936 | CapturedOut::SetColor(Some(TITLE_COLOR), None), |
| 937 | CapturedOut::Print(spec), |
| 938 | CapturedOut::SetColor(None, None), |
| 939 | CapturedOut::Print("".to_owned()), |
| 940 | CapturedOut::Print(" This is the blurb.".to_owned()), |
| 941 | CapturedOut::Print("".to_owned()), |
| 942 | CapturedOut::Print(" First paragraph of the extended description.".to_owned()), |
| 943 | CapturedOut::Print("".to_owned()), |
| 944 | CapturedOut::Print(" Second paragraph of the extended description.".to_owned()), |
| 945 | CapturedOut::Print("".to_owned()), |
| 946 | ] |
| 947 | } |
| 948 | |
| 949 | for cmd in &[r#"help "aa""#, r#"help "aab""#, r#"help "aabc""#] { |
| 950 | tester_with(vec![ |
| 951 | EmptyFunction::new_with_name("AABC"), |
| 952 | EmptyFunction::new_with_name("ABC"), |
| 953 | EmptyFunction::new_with_name("BC"), |
| 954 | ]) |
| 955 | .run(*cmd) |
| 956 | .expect_output(exp_output("AABC$", true)) |
| 957 | .check(); |
| 958 | } |
| 959 | |
| 960 | for cmd in &[r#"help "b""#, r#"help "bc""#] { |
| 961 | tester_with(vec![ |
| 962 | EmptyFunction::new_with_name("AABC"), |
| 963 | EmptyFunction::new_with_name("ABC"), |
| 964 | EmptyFunction::new_with_name("BC"), |
| 965 | ]) |
| 966 | .run(*cmd) |
| 967 | .expect_output(exp_output("BC$", true)) |
| 968 | .check(); |
| 969 | } |
| 970 | |
| 971 | tester_with(vec![ |
| 972 | DoNothingCommand::new_with_name("AAAB"), |
| 973 | DoNothingCommand::new_with_name("AAAA"), |
| 974 | DoNothingCommand::new_with_name("AAAAA"), |
| 975 | ]) |
| 976 | .run(r#"help "aaaa""#) |
| 977 | .expect_output(exp_output("AAAA", false)) |
| 978 | .check(); |
| 979 | |
| 980 | tester_with(vec![ |
| 981 | DoNothingCommand::new_with_name("ZAB"), |
| 982 | EmptyFunction::new_with_name("ZABC"), |
| 983 | EmptyFunction::new_with_name("ZAABC"), |
| 984 | ]) |
nothing calls this directly
no test coverage detected