about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDuong Quoc Khanh <dqkqdlot@gmail.com>2023-02-08 01:50:09 +0900
committerDuong Quoc Khanh <dqkqdlot@gmail.com>2023-02-08 01:50:09 +0900
commit370ba94ca2c610fb91288c8198ccd02db0eb54f5 (patch)
tree42311b272436ff97702fb0d9bbe97f5618589e47
parenta7df61f1d35d05100722af1ec90bccd68dd8ad9c (diff)
downloadrust-370ba94ca2c610fb91288c8198ccd02db0eb54f5.tar.gz
rust-370ba94ca2c610fb91288c8198ccd02db0eb54f5.zip
Add more tests.
Add tests for control flows and `let`.
-rw-r--r--crates/ide-completion/src/completions/postfix.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/crates/ide-completion/src/completions/postfix.rs b/crates/ide-completion/src/completions/postfix.rs
index 19df8e2b206..c68d106d835 100644
--- a/crates/ide-completion/src/completions/postfix.rs
+++ b/crates/ide-completion/src/completions/postfix.rs
@@ -541,6 +541,26 @@ fn main() {
             r#"fn main() { loop { foo }.$0 }"#,
             r#"fn main() { unsafe { loop { foo } } }"#,
         );
+        check_edit(
+            "unsafe",
+            r#"fn main() { if true {}.$0 }"#,
+            r#"fn main() { unsafe { if true {} } }"#,
+        );
+        check_edit(
+            "unsafe",
+            r#"fn main() { while true {}.$0 }"#,
+            r#"fn main() { unsafe { while true {} } }"#,
+        );
+        check_edit(
+            "unsafe",
+            r#"fn main() { for i in 0..10 {}.$0 }"#,
+            r#"fn main() { unsafe { for i in 0..10 {} } }"#,
+        );
+        check_edit(
+            "unsafe",
+            r#"fn main() { let x = if true {1} else {2}.$0 }"#,
+            r#"fn main() { let x = unsafe { if true {1} else {2} } }"#,
+        );
     }
 
     #[test]