Add test 'comments_in_block_expr' in in 'extract_function'

This commit is contained in:
roife 2024-01-10 15:00:58 +08:00
parent bc54775c9d
commit d327f3036c

View file

@ -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]
fn in_left_curly_is_not_applicable() {
cov_mark::check!(extract_function_in_braces_is_not_applicable);