mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
Add test 'comments_in_block_expr' in in 'extract_function'
This commit is contained in:
parent
bc54775c9d
commit
d327f3036c
1 changed files with 31 additions and 0 deletions
|
@ -5976,6 +5976,37 @@ fn $0fun_name() -> ControlFlow<()> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn comments_in_block_expr() {
|
||||||
|
check_assist(
|
||||||
|
extract_function,
|
||||||
|
r#"
|
||||||
|
fn f() {
|
||||||
|
let c = $0{
|
||||||
|
// comment 1
|
||||||
|
let a = 2 + 3;
|
||||||
|
// comment 2
|
||||||
|
let b = 5;
|
||||||
|
a + b
|
||||||
|
}$0;
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
r#"
|
||||||
|
fn f() {
|
||||||
|
let c = fun_name();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn $0fun_name() -> i32 {
|
||||||
|
// comment 1
|
||||||
|
let a = 2 + 3;
|
||||||
|
// comment 2
|
||||||
|
let b = 5;
|
||||||
|
a + b
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn in_left_curly_is_not_applicable() {
|
fn in_left_curly_is_not_applicable() {
|
||||||
cov_mark::check!(extract_function_in_braces_is_not_applicable);
|
cov_mark::check!(extract_function_in_braces_is_not_applicable);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue