From 6630266ce17112bb42f2fa62f975d53512ace682 Mon Sep 17 00:00:00 2001 From: unexge Date: Wed, 21 Apr 2021 16:20:08 +0300 Subject: Add multi file test for "Convert to named struct" assist --- .../convert_tuple_struct_to_named_struct.rs | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'crates/ide_assists/src/handlers') 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 @@ -384,6 +384,39 @@ impl A { ); } + #[test] + fn convert_struct_with_multi_file_references() { + check_assist( + convert_tuple_struct_to_named_struct, + r#" +//- /main.rs +struct Inner; +struct A$0(Inner); + +mod foo; + +//- /foo.rs +use crate::{A, Inner}; +fn f() { + let a = A(Inner); +} +"#, + r#" +//- /main.rs +struct Inner; +struct A { field1: Inner } + +mod foo; + +//- /foo.rs +use crate::{A, Inner}; +fn f() { + let a = A { field1: Inner }; +} +"#, + ); + } + #[test] fn convert_struct_with_where_clause() { check_assist( -- cgit v1.2.3