feat: add "mentoring instructions" test for pull up assist

This commit is contained in:
Aleksey Kladov 2021-05-08 23:19:08 +03:00
parent 1755b57e1a
commit 1ee12b5db1

View File

@ -95,7 +95,6 @@ impl<'a> AssignmentsCollector<'a> {
for arm in match_expr.match_arm_list()?.arms() {
match arm.expr()? {
ast::Expr::BlockExpr(block) => self.collect_block(&block)?,
// TODO: Handle this while we are at it?
_ => return None,
}
}
@ -241,6 +240,38 @@ fn foo() {
);
}
#[test]
#[ignore]
fn test_pull_assignment_up_assignment_expressions() {
check_assist(
pull_assignment_up,
r#"
fn foo() {
let mut a = 1;
match 1 {
1 => { $0a = 2; },
2 => a = 3,
3 => {
a = 4
}
}
}"#,
r#"
fn foo() {
let mut a = 1;
a = match 1 {
1 => { 2 },
2 => 3,
3 => {
4
}
};
}"#,
);
}
#[test]
fn test_pull_assignment_up_not_last_not_applicable() {
check_assist_not_applicable(