diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-11-09 13:44:44 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-11-09 13:44:44 +0000 |
commit | 6b92cc4384361185f990cb614e5007a62f13523c (patch) | |
tree | 8dccaadbf1fc9e012a4c7b2293adaa778584fe33 /crates/assists/src/handlers | |
parent | 9febb9eb0ec42d6b3fea6685402faef26f8b8186 (diff) | |
parent | 018f826197bfc5b09c2aa2278714aadb7a66879a (diff) |
Merge #6509
6509: Support multi-file assist tests r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/assists/src/handlers')
-rw-r--r-- | crates/assists/src/handlers/extract_struct_from_enum_variant.rs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/crates/assists/src/handlers/extract_struct_from_enum_variant.rs b/crates/assists/src/handlers/extract_struct_from_enum_variant.rs index 14209b771..58aadcef7 100644 --- a/crates/assists/src/handlers/extract_struct_from_enum_variant.rs +++ b/crates/assists/src/handlers/extract_struct_from_enum_variant.rs | |||
@@ -345,6 +345,43 @@ fn another_fn() { | |||
345 | ); | 345 | ); |
346 | } | 346 | } |
347 | 347 | ||
348 | #[test] | ||
349 | fn test_several_files() { | ||
350 | check_assist( | ||
351 | extract_struct_from_enum_variant, | ||
352 | r#" | ||
353 | //- /main.rs | ||
354 | enum E { | ||
355 | <|>V(i32, i32) | ||
356 | } | ||
357 | mod foo; | ||
358 | |||
359 | //- /foo.rs | ||
360 | use crate::E; | ||
361 | fn f() { | ||
362 | let e = E::V(9, 2); | ||
363 | } | ||
364 | "#, | ||
365 | r#" | ||
366 | //- /main.rs | ||
367 | struct V(pub i32, pub i32); | ||
368 | |||
369 | enum E { | ||
370 | V(V) | ||
371 | } | ||
372 | mod foo; | ||
373 | |||
374 | //- /foo.rs | ||
375 | use V; | ||
376 | |||
377 | use crate::E; | ||
378 | fn f() { | ||
379 | let e = E::V(V(9, 2)); | ||
380 | } | ||
381 | "#, | ||
382 | ) | ||
383 | } | ||
384 | |||
348 | fn check_not_applicable(ra_fixture: &str) { | 385 | fn check_not_applicable(ra_fixture: &str) { |
349 | let fixture = | 386 | let fixture = |
350 | format!("//- /main.rs crate:main deps:core\n{}\n{}", ra_fixture, FamousDefs::FIXTURE); | 387 | format!("//- /main.rs crate:main deps:core\n{}\n{}", ra_fixture, FamousDefs::FIXTURE); |