From 31204e3590a59a6c0cbae53d111b699d92fb229f Mon Sep 17 00:00:00 2001 From: Jesse Bakker Date: Sat, 2 Jan 2021 01:55:56 +0100 Subject: Add extract-assignment assist --- crates/assists/src/tests/generated.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'crates/assists/src/tests') diff --git a/crates/assists/src/tests/generated.rs b/crates/assists/src/tests/generated.rs index d3dfe24e7..b91a816e8 100644 --- a/crates/assists/src/tests/generated.rs +++ b/crates/assists/src/tests/generated.rs @@ -237,6 +237,35 @@ fn qux(bar: Bar, baz: Baz) {} ) } +#[test] +fn doctest_extract_assignment() { + check_doc_test( + "extract_assignment", + r#####" +fn main() { + let mut foo = 6; + + if true { + <|>foo = 5; + } else { + foo = 4; + } +} +"#####, + r#####" +fn main() { + let mut foo = 6; + + foo = if true { + 5 + } else { + 4 + }; +} +"#####, + ) +} + #[test] fn doctest_extract_module_to_file() { check_doc_test( -- cgit v1.2.3