diff options
author | Vladyslav Katasonov <[email protected]> | 2021-02-03 07:57:11 +0000 |
---|---|---|
committer | Vladyslav Katasonov <[email protected]> | 2021-02-03 07:57:11 +0000 |
commit | bc3ae81a873173346df6cb000e503233d7558d03 (patch) | |
tree | e313503ad7fc44ff8681bcd0e02d8853a98c5bc9 /crates/assists/src/tests | |
parent | 7e66cde76460d61cb19a19e4bb7bc1f6642e993d (diff) |
initial version of extract function assist
there are a few currently limitations:
* no modifications of function body
* does not handle mutability and references
* no method support
* may produce incorrect results
Diffstat (limited to 'crates/assists/src/tests')
-rw-r--r-- | crates/assists/src/tests/generated.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/crates/assists/src/tests/generated.rs b/crates/assists/src/tests/generated.rs index 9aa807f10..e84f208a3 100644 --- a/crates/assists/src/tests/generated.rs +++ b/crates/assists/src/tests/generated.rs | |||
@@ -257,6 +257,33 @@ fn qux(bar: Bar, baz: Baz) {} | |||
257 | } | 257 | } |
258 | 258 | ||
259 | #[test] | 259 | #[test] |
260 | fn doctest_extract_function() { | ||
261 | check_doc_test( | ||
262 | "extract_function", | ||
263 | r#####" | ||
264 | fn main() { | ||
265 | let n = 1; | ||
266 | $0let m = n + 2; | ||
267 | let k = m + n;$0 | ||
268 | let g = 3; | ||
269 | } | ||
270 | "#####, | ||
271 | r#####" | ||
272 | fn main() { | ||
273 | let n = 1; | ||
274 | fun_name(n); | ||
275 | let g = 3; | ||
276 | } | ||
277 | |||
278 | fn $0fun_name(n: i32) { | ||
279 | let m = n + 2; | ||
280 | let k = m + n; | ||
281 | } | ||
282 | "#####, | ||
283 | ) | ||
284 | } | ||
285 | |||
286 | #[test] | ||
260 | fn doctest_extract_struct_from_enum_variant() { | 287 | fn doctest_extract_struct_from_enum_variant() { |
261 | check_doc_test( | 288 | check_doc_test( |
262 | "extract_struct_from_enum_variant", | 289 | "extract_struct_from_enum_variant", |