Skip to content

Commit d327f30

Browse files
committed
Add test 'comments_in_block_expr' in in 'extract_function'
1 parent bc54775 commit d327f30

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

crates/ide-assists/src/handlers/extract_function.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5976,6 +5976,37 @@ fn $0fun_name() -> ControlFlow<()> {
59765976
);
59775977
}
59785978

5979+
#[test]
5980+
fn comments_in_block_expr() {
5981+
check_assist(
5982+
extract_function,
5983+
r#"
5984+
fn f() {
5985+
let c = $0{
5986+
// comment 1
5987+
let a = 2 + 3;
5988+
// comment 2
5989+
let b = 5;
5990+
a + b
5991+
}$0;
5992+
}
5993+
"#,
5994+
r#"
5995+
fn f() {
5996+
let c = fun_name();
5997+
}
5998+
5999+
fn $0fun_name() -> i32 {
6000+
// comment 1
6001+
let a = 2 + 3;
6002+
// comment 2
6003+
let b = 5;
6004+
a + b
6005+
}
6006+
"#,
6007+
);
6008+
}
6009+
59796010
#[test]
59806011
fn in_left_curly_is_not_applicable() {
59816012
cov_mark::check!(extract_function_in_braces_is_not_applicable);

0 commit comments

Comments
 (0)