Unnamed repository; edit this file 'description' to name the repository.
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`
bors 2022-05-25
parent 0468d84 · parent c06c4f9 · commit 5b69a34
-rw-r--r--crates/ide-assists/src/handlers/generate_enum_variant.rs27
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 fa6242460b..b57076d999 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,