diff options
| author | bors <bors@rust-lang.org> | 2022-05-25 16:42:29 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-05-25 16:42:29 +0000 |
| commit | 5b69a34fb5a931908b54e348dc810ae8faf29ddc (patch) | |
| tree | cbbf9f6bfdc45a2b6f7ebad097a8b2915bf35ec4 | |
| parent | 0468d84564717eb5fb4e06d901aaac4d94c5de87 (diff) | |
| parent | c06c4f968264226a8ce36b91545ec3e72e0b6364 (diff) | |
| download | rust-5b69a34fb5a931908b54e348dc810ae8faf29ddc.tar.gz rust-5b69a34fb5a931908b54e348dc810ae8faf29ddc.zip | |
Auto merge of #12386 - fasterthanlime:gh-12372-test, r=Veykril
Add test for #12372 (generate enum variant in different file) The test currently fails but I'm not sure why. The "Right" output seems to contain only the contents of `foo.rs`, without the magic comments: <img width="967" alt="image" src="https://user-images.githubusercontent.com/7998310/170310707-e69b21eb-d4f8-46c1-8a0a-9b4071289e26.png"> cc `@Veykril`
| -rw-r--r-- | crates/ide-assists/src/handlers/generate_enum_variant.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/crates/ide-assists/src/handlers/generate_enum_variant.rs b/crates/ide-assists/src/handlers/generate_enum_variant.rs index fa6242460b0..b57076d9992 100644 --- a/crates/ide-assists/src/handlers/generate_enum_variant.rs +++ b/crates/ide-assists/src/handlers/generate_enum_variant.rs @@ -141,6 +141,33 @@ fn main() { } #[test] + fn generate_basic_enum_variant_in_different_file() { + check_assist( + generate_enum_variant, + r" +//- /main.rs +mod foo; +use foo::Foo; + +fn main() { + Foo::Baz$0 +} + +//- /foo.rs +enum Foo { + Bar, +} +", + r" +enum Foo { + Bar, + Baz, +} +", + ) + } + + #[test] fn not_applicable_for_existing_variant() { check_assist_not_applicable( generate_enum_variant, |
