diff options
Diffstat (limited to 'crates/assists/src/handlers')
-rw-r--r-- | crates/assists/src/handlers/extract_struct_from_enum_variant.rs | 30 |
1 files changed, 30 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 58aadcef7..84662d832 100644 --- a/crates/assists/src/handlers/extract_struct_from_enum_variant.rs +++ b/crates/assists/src/handlers/extract_struct_from_enum_variant.rs | |||
@@ -382,6 +382,36 @@ fn f() { | |||
382 | ) | 382 | ) |
383 | } | 383 | } |
384 | 384 | ||
385 | #[test] | ||
386 | fn test_several_files_record() { | ||
387 | // FIXME: this should fix the usage as well! | ||
388 | check_assist( | ||
389 | extract_struct_from_enum_variant, | ||
390 | r#" | ||
391 | //- /main.rs | ||
392 | enum E { | ||
393 | <|>V { i: i32, j: i32 } | ||
394 | } | ||
395 | mod foo; | ||
396 | |||
397 | //- /foo.rs | ||
398 | use crate::E; | ||
399 | fn f() { | ||
400 | let e = E::V { i: 9, j: 2 }; | ||
401 | } | ||
402 | "#, | ||
403 | r#" | ||
404 | struct V{ pub i: i32, pub j: i32 } | ||
405 | |||
406 | enum E { | ||
407 | V(V) | ||
408 | } | ||
409 | mod foo; | ||
410 | |||
411 | "#, | ||
412 | ) | ||
413 | } | ||
414 | |||
385 | fn check_not_applicable(ra_fixture: &str) { | 415 | fn check_not_applicable(ra_fixture: &str) { |
386 | let fixture = | 416 | let fixture = |
387 | format!("//- /main.rs crate:main deps:core\n{}\n{}", ra_fixture, FamousDefs::FIXTURE); | 417 | format!("//- /main.rs crate:main deps:core\n{}\n{}", ra_fixture, FamousDefs::FIXTURE); |