Skip to content

Commit 6630266

Browse files
committed
Add multi file test for "Convert to named struct" assist
1 parent 96d6940 commit 6630266

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

crates/ide_assists/src/handlers/convert_tuple_struct_to_named_struct.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,39 @@ impl A {
384384
);
385385
}
386386

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
393+
struct Inner;
394+
struct A$0(Inner);
395+
396+
mod foo;
397+
398+
//- /foo.rs
399+
use crate::{A, Inner};
400+
fn f() {
401+
let a = A(Inner);
402+
}
403+
"#,
404+
r#"
405+
//- /main.rs
406+
struct Inner;
407+
struct A { field1: Inner }
408+
409+
mod foo;
410+
411+
//- /foo.rs
412+
use crate::{A, Inner};
413+
fn f() {
414+
let a = A { field1: Inner };
415+
}
416+
"#,
417+
);
418+
}
419+
387420
#[test]
388421
fn convert_struct_with_where_clause() {
389422
check_assist(

0 commit comments

Comments
 (0)