aboutsummaryrefslogtreecommitdiff
path: root/crates/assists/src/handlers
diff options
context:
space:
mode:
Diffstat (limited to 'crates/assists/src/handlers')
-rw-r--r--crates/assists/src/handlers/extract_struct_from_enum_variant.rs30
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
392enum E {
393 <|>V { i: i32, j: i32 }
394}
395mod foo;
396
397//- /foo.rs
398use crate::E;
399fn f() {
400 let e = E::V { i: 9, j: 2 };
401}
402"#,
403 r#"
404struct V{ pub i: i32, pub j: i32 }
405
406enum E {
407 V(V)
408}
409mod 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);