Skip to content

Commit 5b69a34

Browse files
committed
Auto merge of rust-lang#12386 - fasterthanlime:rust-langgh-12372-test, r=Veykril
Add test for rust-lang#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`
2 parents 0468d84 + c06c4f9 commit 5b69a34

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

crates/ide-assists/src/handlers/generate_enum_variant.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,33 @@ fn main() {
140140
)
141141
}
142142

143+
#[test]
144+
fn generate_basic_enum_variant_in_different_file() {
145+
check_assist(
146+
generate_enum_variant,
147+
r"
148+
//- /main.rs
149+
mod foo;
150+
use foo::Foo;
151+
152+
fn main() {
153+
Foo::Baz$0
154+
}
155+
156+
//- /foo.rs
157+
enum Foo {
158+
Bar,
159+
}
160+
",
161+
r"
162+
enum Foo {
163+
Bar,
164+
Baz,
165+
}
166+
",
167+
)
168+
}
169+
143170
#[test]
144171
fn not_applicable_for_existing_variant() {
145172
check_assist_not_applicable(

0 commit comments

Comments
 (0)