aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_assists/src
diff options
context:
space:
mode:
authorunexge <[email protected]>2021-04-21 14:20:08 +0100
committerunexge <[email protected]>2021-04-21 14:20:08 +0100
commit6630266ce17112bb42f2fa62f975d53512ace682 (patch)
tree585df87694126e402bd185f65e5601cf43bfffb8 /crates/ide_assists/src
parent96d694062bfbb94592dfdef7517c500aedcb9185 (diff)
Add multi file test for "Convert to named struct" assist
Diffstat (limited to 'crates/ide_assists/src')
-rw-r--r--crates/ide_assists/src/handlers/convert_tuple_struct_to_named_struct.rs33
1 files changed, 33 insertions, 0 deletions
diff --git a/crates/ide_assists/src/handlers/convert_tuple_struct_to_named_struct.rs b/crates/ide_assists/src/handlers/convert_tuple_struct_to_named_struct.rs
index 086a44425..0df96be03 100644
--- a/crates/ide_assists/src/handlers/convert_tuple_struct_to_named_struct.rs
+++ b/crates/ide_assists/src/handlers/convert_tuple_struct_to_named_struct.rs
@@ -385,6 +385,39 @@ impl A {
385 } 385 }
386 386
387 #[test] 387 #[test]
388 fn convert_struct_with_multi_file_references() {
389 check_assist(
390 convert_tuple_struct_to_named_struct,
391 r#"
392//- /main.rs
393struct Inner;
394struct A$0(Inner);
395
396mod foo;
397
398//- /foo.rs
399use crate::{A, Inner};
400fn f() {
401 let a = A(Inner);
402}
403"#,
404 r#"
405//- /main.rs
406struct Inner;
407struct A { field1: Inner }
408
409mod foo;
410
411//- /foo.rs
412use crate::{A, Inner};
413fn f() {
414 let a = A { field1: Inner };
415}
416"#,
417 );
418 }
419
420 #[test]
388 fn convert_struct_with_where_clause() { 421 fn convert_struct_with_where_clause() {
389 check_assist( 422 check_assist(
390 convert_tuple_struct_to_named_struct, 423 convert_tuple_struct_to_named_struct,