Add a check_assist_* overload and move tests under assists

This commit is contained in:
Ali Bektas 2025-02-18 21:58:27 +01:00
parent fc10fe44de
commit 9d5a97368a
3 changed files with 66 additions and 37 deletions

View file

@ -217,7 +217,9 @@ pub(crate) fn generate_delegate_methods(acc: &mut Assists, ctx: &AssistContext<'
#[cfg(test)]
mod tests {
use crate::tests::{check_assist, check_assist_not_applicable};
use crate::tests::{
check_assist, check_assist_not_applicable, check_assist_not_applicable_no_grouping,
};
use super::*;
@ -721,4 +723,21 @@ impl Person {
"#,
);
}
#[test]
fn delegate_method_skipped_when_no_grouping() {
check_assist_not_applicable_no_grouping(
generate_delegate_methods,
r#"
struct Age(u8);
impl Age {
fn age(&self) -> u8 {
self.0
}
}
struct Person {
ag$0e: Age,
}"#,
);
}
}