diff options
Diffstat (limited to 'crates/assists/src/tests/generated.rs')
-rw-r--r-- | crates/assists/src/tests/generated.rs | 81 |
1 files changed, 49 insertions, 32 deletions
diff --git a/crates/assists/src/tests/generated.rs b/crates/assists/src/tests/generated.rs index acbf5b652..dbf4f21aa 100644 --- a/crates/assists/src/tests/generated.rs +++ b/crates/assists/src/tests/generated.rs | |||
@@ -3,25 +3,6 @@ | |||
3 | use super::check_doc_test; | 3 | use super::check_doc_test; |
4 | 4 | ||
5 | #[test] | 5 | #[test] |
6 | fn doctest_add_custom_impl() { | ||
7 | check_doc_test( | ||
8 | "add_custom_impl", | ||
9 | r#####" | ||
10 | #[derive(Deb<|>ug, Display)] | ||
11 | struct S; | ||
12 | "#####, | ||
13 | r#####" | ||
14 | #[derive(Display)] | ||
15 | struct S; | ||
16 | |||
17 | impl Debug for S { | ||
18 | $0 | ||
19 | } | ||
20 | "#####, | ||
21 | ) | ||
22 | } | ||
23 | |||
24 | #[test] | ||
25 | fn doctest_add_explicit_type() { | 6 | fn doctest_add_explicit_type() { |
26 | check_doc_test( | 7 | check_doc_test( |
27 | "add_explicit_type", | 8 | "add_explicit_type", |
@@ -178,19 +159,6 @@ pub mod std { pub mod collections { pub struct HashMap { } } } | |||
178 | } | 159 | } |
179 | 160 | ||
180 | #[test] | 161 | #[test] |
181 | fn doctest_change_return_type_to_result() { | ||
182 | check_doc_test( | ||
183 | "change_return_type_to_result", | ||
184 | r#####" | ||
185 | fn foo() -> i32<|> { 42i32 } | ||
186 | "#####, | ||
187 | r#####" | ||
188 | fn foo() -> Result<i32, ${0:_}> { Ok(42i32) } | ||
189 | "#####, | ||
190 | ) | ||
191 | } | ||
192 | |||
193 | #[test] | ||
194 | fn doctest_change_visibility() { | 162 | fn doctest_change_visibility() { |
195 | check_doc_test( | 163 | check_doc_test( |
196 | "change_visibility", | 164 | "change_visibility", |
@@ -506,6 +474,19 @@ impl<T: Clone> Ctx<T> { | |||
506 | } | 474 | } |
507 | 475 | ||
508 | #[test] | 476 | #[test] |
477 | fn doctest_infer_function_return_type() { | ||
478 | check_doc_test( | ||
479 | "infer_function_return_type", | ||
480 | r#####" | ||
481 | fn foo() { 4<|>2i32 } | ||
482 | "#####, | ||
483 | r#####" | ||
484 | fn foo() -> i32 { 42i32 } | ||
485 | "#####, | ||
486 | ) | ||
487 | } | ||
488 | |||
489 | #[test] | ||
509 | fn doctest_inline_local_variable() { | 490 | fn doctest_inline_local_variable() { |
510 | check_doc_test( | 491 | check_doc_test( |
511 | "inline_local_variable", | 492 | "inline_local_variable", |
@@ -819,6 +800,29 @@ const test: Foo = Foo {foo: 1, bar: 0} | |||
819 | } | 800 | } |
820 | 801 | ||
821 | #[test] | 802 | #[test] |
803 | fn doctest_replace_derive_with_manual_impl() { | ||
804 | check_doc_test( | ||
805 | "replace_derive_with_manual_impl", | ||
806 | r#####" | ||
807 | trait Debug { fn fmt(&self, f: &mut Formatter) -> Result<()>; } | ||
808 | #[derive(Deb<|>ug, Display)] | ||
809 | struct S; | ||
810 | "#####, | ||
811 | r#####" | ||
812 | trait Debug { fn fmt(&self, f: &mut Formatter) -> Result<()>; } | ||
813 | #[derive(Display)] | ||
814 | struct S; | ||
815 | |||
816 | impl Debug for S { | ||
817 | fn fmt(&self, f: &mut Formatter) -> Result<()> { | ||
818 | ${0:todo!()} | ||
819 | } | ||
820 | } | ||
821 | "#####, | ||
822 | ) | ||
823 | } | ||
824 | |||
825 | #[test] | ||
822 | fn doctest_replace_if_let_with_match() { | 826 | fn doctest_replace_if_let_with_match() { |
823 | check_doc_test( | 827 | check_doc_test( |
824 | "replace_if_let_with_match", | 828 | "replace_if_let_with_match", |
@@ -972,3 +976,16 @@ fn foo() { | |||
972 | "#####, | 976 | "#####, |
973 | ) | 977 | ) |
974 | } | 978 | } |
979 | |||
980 | #[test] | ||
981 | fn doctest_wrap_return_type_in_result() { | ||
982 | check_doc_test( | ||
983 | "wrap_return_type_in_result", | ||
984 | r#####" | ||
985 | fn foo() -> i32<|> { 42i32 } | ||
986 | "#####, | ||
987 | r#####" | ||
988 | fn foo() -> Result<i32, ${0:_}> { Ok(42i32) } | ||
989 | "#####, | ||
990 | ) | ||
991 | } | ||