diff options
author | unexge <[email protected]> | 2021-04-21 14:20:08 +0100 |
---|---|---|
committer | unexge <[email protected]> | 2021-04-21 14:20:08 +0100 |
commit | 6630266ce17112bb42f2fa62f975d53512ace682 (patch) | |
tree | 585df87694126e402bd185f65e5601cf43bfffb8 /crates | |
parent | 96d694062bfbb94592dfdef7517c500aedcb9185 (diff) |
Add multi file test for "Convert to named struct" assist
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ide_assists/src/handlers/convert_tuple_struct_to_named_struct.rs | 33 |
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 | ||
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 | |||
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, |