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.rs60
1 files changed, 57 insertions, 3 deletions
diff --git a/crates/ide-assists/src/tests/generated.rs b/crates/ide-assists/src/tests/generated.rs
index 7f0836abdf..3040509000 100644
--- a/crates/ide-assists/src/tests/generated.rs
+++ b/crates/ide-assists/src/tests/generated.rs
@@ -70,6 +70,27 @@ enum TheEnum {
}
#[test]
+fn doctest_add_explicit_method_call_deref() {
+ check_doc_test(
+ "add_explicit_method_call_deref",
+ r#####"
+struct Foo;
+impl Foo { fn foo(&self) {} }
+fn test() {
+ Foo$0.$0foo();
+}
+"#####,
+ r#####"
+struct Foo;
+impl Foo { fn foo(&self) {} }
+fn test() {
+ (&Foo).foo();
+}
+"#####,
+ )
+}
+
+#[test]
fn doctest_add_explicit_type() {
check_doc_test(
"add_explicit_type",
@@ -183,9 +204,9 @@ fn main() {
"#####,
r#####"
fn main() {
- 'l: loop {
- break 'l;
- continue 'l;
+ ${1:'l}: loop {
+ break ${2:'l};
+ continue ${0:'l};
}
}
"#####,
@@ -425,6 +446,19 @@ fn main() {
}
#[test]
+fn doctest_convert_char_literal() {
+ check_doc_test(
+ "convert_char_literal",
+ r#####"
+const _: char = 'a'$0;
+"#####,
+ r#####"
+const _: char = '\x61';
+"#####,
+ )
+}
+
+#[test]
fn doctest_convert_closure_to_fn() {
check_doc_test(
"convert_closure_to_fn",
@@ -779,6 +813,26 @@ fn main() {
}
#[test]
+fn doctest_convert_to_guarded_return_1() {
+ check_doc_test(
+ "convert_to_guarded_return",
+ r#####"
+//- minicore: option
+fn foo() -> Option<i32> { None }
+fn main() {
+ $0let x = foo();
+}
+"#####,
+ r#####"
+fn foo() -> Option<i32> { None }
+fn main() {
+ let Some(x) = foo() else { return };
+}
+"#####,
+ )
+}
+
+#[test]
fn doctest_convert_tuple_return_type_to_struct() {
check_doc_test(
"convert_tuple_return_type_to_struct",