add test coverage for separate clippy prefixes

Signed-off-by: onur-ozkan <work@onurozkan.dev>
This commit is contained in:
onur-ozkan 2024-11-10 23:07:00 +03:00
parent 6643586a1d
commit 469c8baab8

View File

@ -323,6 +323,23 @@ fn order_of_clippy_rules() {
assert_eq!(expected, actual); assert_eq!(expected, actual);
} }
#[test]
fn clippy_rule_separate_prefix() {
let args =
vec!["clippy".to_string(), "-A clippy:all".to_string(), "-W clippy::style".to_string()];
let config = Config::parse(Flags::parse(&args));
let actual = match &config.cmd {
crate::Subcommand::Clippy { allow, deny, warn, forbid, .. } => {
get_clippy_rules_in_order(&args, &allow, &deny, &warn, &forbid)
}
_ => panic!("invalid subcommand"),
};
let expected = vec!["-A clippy:all".to_string(), "-W clippy::style".to_string()];
assert_eq!(expected, actual);
}
#[test] #[test]
fn verbose_tests_default_value() { fn verbose_tests_default_value() {
let config = Config::parse(Flags::parse(&["build".into(), "compiler".into()])); let config = Config::parse(Flags::parse(&["build".into(), "compiler".into()]));