aboutsummaryrefslogtreecommitdiff
path: root/crates/assists/src/tests/generated.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/assists/src/tests/generated.rs')
-rw-r--r--crates/assists/src/tests/generated.rs81
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 @@
3use super::check_doc_test; 3use super::check_doc_test;
4 4
5#[test] 5#[test]
6fn doctest_add_custom_impl() {
7 check_doc_test(
8 "add_custom_impl",
9 r#####"
10#[derive(Deb<|>ug, Display)]
11struct S;
12"#####,
13 r#####"
14#[derive(Display)]
15struct S;
16
17impl Debug for S {
18 $0
19}
20"#####,
21 )
22}
23
24#[test]
25fn doctest_add_explicit_type() { 6fn 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]
181fn doctest_change_return_type_to_result() {
182 check_doc_test(
183 "change_return_type_to_result",
184 r#####"
185fn foo() -> i32<|> { 42i32 }
186"#####,
187 r#####"
188fn foo() -> Result<i32, ${0:_}> { Ok(42i32) }
189"#####,
190 )
191}
192
193#[test]
194fn doctest_change_visibility() { 162fn 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]
477fn doctest_infer_function_return_type() {
478 check_doc_test(
479 "infer_function_return_type",
480 r#####"
481fn foo() { 4<|>2i32 }
482"#####,
483 r#####"
484fn foo() -> i32 { 42i32 }
485"#####,
486 )
487}
488
489#[test]
509fn doctest_inline_local_variable() { 490fn 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]
803fn doctest_replace_derive_with_manual_impl() {
804 check_doc_test(
805 "replace_derive_with_manual_impl",
806 r#####"
807trait Debug { fn fmt(&self, f: &mut Formatter) -> Result<()>; }
808#[derive(Deb<|>ug, Display)]
809struct S;
810"#####,
811 r#####"
812trait Debug { fn fmt(&self, f: &mut Formatter) -> Result<()>; }
813#[derive(Display)]
814struct S;
815
816impl Debug for S {
817 fn fmt(&self, f: &mut Formatter) -> Result<()> {
818 ${0:todo!()}
819 }
820}
821"#####,
822 )
823}
824
825#[test]
822fn doctest_replace_if_let_with_match() { 826fn 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]
981fn doctest_wrap_return_type_in_result() {
982 check_doc_test(
983 "wrap_return_type_in_result",
984 r#####"
985fn foo() -> i32<|> { 42i32 }
986"#####,
987 r#####"
988fn foo() -> Result<i32, ${0:_}> { Ok(42i32) }
989"#####,
990 )
991}