diff options
Diffstat (limited to 'crates/assists/src/tests/generated.rs')
-rw-r--r-- | crates/assists/src/tests/generated.rs | 88 |
1 files changed, 56 insertions, 32 deletions
diff --git a/crates/assists/src/tests/generated.rs b/crates/assists/src/tests/generated.rs index 168e1626a..5a9d1a01b 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,26 @@ impl<T: Clone> Ctx<T> { | |||
506 | } | 474 | } |
507 | 475 | ||
508 | #[test] | 476 | #[test] |
477 | fn doctest_ignore_test() { | ||
478 | check_doc_test( | ||
479 | "ignore_test", | ||
480 | r#####" | ||
481 | <|>#[test] | ||
482 | fn arithmetics { | ||
483 | assert_eq!(2 + 2, 5); | ||
484 | } | ||
485 | "#####, | ||
486 | r#####" | ||
487 | #[test] | ||
488 | #[ignore] | ||
489 | fn arithmetics { | ||
490 | assert_eq!(2 + 2, 5); | ||
491 | } | ||
492 | "#####, | ||
493 | ) | ||
494 | } | ||
495 | |||
496 | #[test] | ||
509 | fn doctest_infer_function_return_type() { | 497 | fn doctest_infer_function_return_type() { |
510 | check_doc_test( | 498 | check_doc_test( |
511 | "infer_function_return_type", | 499 | "infer_function_return_type", |
@@ -832,6 +820,29 @@ const test: Foo = Foo {foo: 1, bar: 0} | |||
832 | } | 820 | } |
833 | 821 | ||
834 | #[test] | 822 | #[test] |
823 | fn doctest_replace_derive_with_manual_impl() { | ||
824 | check_doc_test( | ||
825 | "replace_derive_with_manual_impl", | ||
826 | r#####" | ||
827 | trait Debug { fn fmt(&self, f: &mut Formatter) -> Result<()>; } | ||
828 | #[derive(Deb<|>ug, Display)] | ||
829 | struct S; | ||
830 | "#####, | ||
831 | r#####" | ||
832 | trait Debug { fn fmt(&self, f: &mut Formatter) -> Result<()>; } | ||
833 | #[derive(Display)] | ||
834 | struct S; | ||
835 | |||
836 | impl Debug for S { | ||
837 | fn fmt(&self, f: &mut Formatter) -> Result<()> { | ||
838 | ${0:todo!()} | ||
839 | } | ||
840 | } | ||
841 | "#####, | ||
842 | ) | ||
843 | } | ||
844 | |||
845 | #[test] | ||
835 | fn doctest_replace_if_let_with_match() { | 846 | fn doctest_replace_if_let_with_match() { |
836 | check_doc_test( | 847 | check_doc_test( |
837 | "replace_if_let_with_match", | 848 | "replace_if_let_with_match", |
@@ -985,3 +996,16 @@ fn foo() { | |||
985 | "#####, | 996 | "#####, |
986 | ) | 997 | ) |
987 | } | 998 | } |
999 | |||
1000 | #[test] | ||
1001 | fn doctest_wrap_return_type_in_result() { | ||
1002 | check_doc_test( | ||
1003 | "wrap_return_type_in_result", | ||
1004 | r#####" | ||
1005 | fn foo() -> i32<|> { 42i32 } | ||
1006 | "#####, | ||
1007 | r#####" | ||
1008 | fn foo() -> Result<i32, ${0:_}> { Ok(42i32) } | ||
1009 | "#####, | ||
1010 | ) | ||
1011 | } | ||