aboutsummaryrefslogtreecommitdiff
path: root/crates/assists/src/handlers/extract_struct_from_enum_variant.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/assists/src/handlers/extract_struct_from_enum_variant.rs')
-rw-r--r--crates/assists/src/handlers/extract_struct_from_enum_variant.rs37
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
354enum E {
355 <|>V(i32, i32)
356}
357mod foo;
358
359//- /foo.rs
360use crate::E;
361fn f() {
362 let e = E::V(9, 2);
363}
364"#,
365 r#"
366//- /main.rs
367struct V(pub i32, pub i32);
368
369enum E {
370 V(V)
371}
372mod foo;
373
374//- /foo.rs
375use V;
376
377use crate::E;
378fn 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);