mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Some improvements to introduce_variable.
This commit is contained in:
parent
7a1494ced5
commit
a5fe4a08fb
3 changed files with 181 additions and 8 deletions
|
@ -23,6 +23,18 @@ pub fn check_action<F: Fn(&SourceFile, TextUnit) -> Option<LocalEdit>>(
|
|||
assert_eq_text!(after, &actual);
|
||||
}
|
||||
|
||||
pub fn check_action_not_applicable<F: Fn(&SourceFile, TextUnit) -> Option<LocalEdit>>(
|
||||
text: &str,
|
||||
f: F,
|
||||
) {
|
||||
let (text_cursor_pos, text) = extract_offset(text);
|
||||
let file = SourceFile::parse(&text);
|
||||
assert!(
|
||||
f(&file, text_cursor_pos).is_none(),
|
||||
"code action is applicable but it shouldn't"
|
||||
);
|
||||
}
|
||||
|
||||
pub fn check_action_range<F: Fn(&SourceFile, TextRange) -> Option<LocalEdit>>(
|
||||
before: &str,
|
||||
after: &str,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue