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.rs88
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 @@
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,26 @@ impl<T: Clone> Ctx<T> {
506} 474}
507 475
508#[test] 476#[test]
477fn doctest_ignore_test() {
478 check_doc_test(
479 "ignore_test",
480 r#####"
481<|>#[test]
482fn arithmetics {
483 assert_eq!(2 + 2, 5);
484}
485"#####,
486 r#####"
487#[test]
488#[ignore]
489fn arithmetics {
490 assert_eq!(2 + 2, 5);
491}
492"#####,
493 )
494}
495
496#[test]
509fn doctest_infer_function_return_type() { 497fn 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]
823fn doctest_replace_derive_with_manual_impl() {
824 check_doc_test(
825 "replace_derive_with_manual_impl",
826 r#####"
827trait Debug { fn fmt(&self, f: &mut Formatter) -> Result<()>; }
828#[derive(Deb<|>ug, Display)]
829struct S;
830"#####,
831 r#####"
832trait Debug { fn fmt(&self, f: &mut Formatter) -> Result<()>; }
833#[derive(Display)]
834struct S;
835
836impl Debug for S {
837 fn fmt(&self, f: &mut Formatter) -> Result<()> {
838 ${0:todo!()}
839 }
840}
841"#####,
842 )
843}
844
845#[test]
835fn doctest_replace_if_let_with_match() { 846fn 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]
1001fn doctest_wrap_return_type_in_result() {
1002 check_doc_test(
1003 "wrap_return_type_in_result",
1004 r#####"
1005fn foo() -> i32<|> { 42i32 }
1006"#####,
1007 r#####"
1008fn foo() -> Result<i32, ${0:_}> { Ok(42i32) }
1009"#####,
1010 )
1011}