From 370ba94ca2c610fb91288c8198ccd02db0eb54f5 Mon Sep 17 00:00:00 2001 From: Duong Quoc Khanh Date: Wed, 8 Feb 2023 01:50:09 +0900 Subject: [PATCH] Add more tests. Add tests for control flows and `let`. --- .../ide-completion/src/completions/postfix.rs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) 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 postfix_completion_for_unsafe() { 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]