Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-assists/src/tests/generated.rs')
| -rw-r--r-- | crates/ide-assists/src/tests/generated.rs | 57 |
1 files changed, 56 insertions, 1 deletions
diff --git a/crates/ide-assists/src/tests/generated.rs b/crates/ide-assists/src/tests/generated.rs index a2287b2977..dce7bbf342 100644 --- a/crates/ide-assists/src/tests/generated.rs +++ b/crates/ide-assists/src/tests/generated.rs @@ -383,6 +383,40 @@ fn main() { } #[test] +fn doctest_convert_closure_to_fn() { + check_doc_test( + "convert_closure_to_fn", + r#####" +//- minicore: copy +struct String; +impl String { + fn new() -> Self {} + fn push_str(&mut self, s: &str) {} +} +fn main() { + let mut s = String::new(); + let closure = |$0a| s.push_str(a); + closure("abc"); +} +"#####, + r#####" +struct String; +impl String { + fn new() -> Self {} + fn push_str(&mut self, s: &str) {} +} +fn main() { + let mut s = String::new(); + fn closure(a: &str, s: &mut String) { + s.push_str(a) + } + closure("abc", &mut s); +} +"#####, + ) +} + +#[test] fn doctest_convert_for_loop_with_for_each() { check_doc_test( "convert_for_loop_with_for_each", @@ -994,7 +1028,7 @@ fn main() { "#####, r#####" fn main() { - let $0var_name = (1 + 2); + let $0var_name = 1 + 2; var_name * 4; } "#####, @@ -3092,6 +3126,27 @@ fn arithmetics { } #[test] +fn doctest_toggle_macro_delimiter() { + check_doc_test( + "toggle_macro_delimiter", + r#####" +macro_rules! sth { + () => {}; +} + +sth!$0( ); +"#####, + r#####" +macro_rules! sth { + () => {}; +} + +sth!{ } +"#####, + ) +} + +#[test] fn doctest_unmerge_match_arm() { check_doc_test( "unmerge_match_arm", |