Skip to content

Commit 370ba94

Browse files
committed
Add more tests.
Add tests for control flows and `let`.
1 parent a7df61f commit 370ba94

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

crates/ide-completion/src/completions/postfix.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,26 @@ fn main() {
541541
r#"fn main() { loop { foo }.$0 }"#,
542542
r#"fn main() { unsafe { loop { foo } } }"#,
543543
);
544+
check_edit(
545+
"unsafe",
546+
r#"fn main() { if true {}.$0 }"#,
547+
r#"fn main() { unsafe { if true {} } }"#,
548+
);
549+
check_edit(
550+
"unsafe",
551+
r#"fn main() { while true {}.$0 }"#,
552+
r#"fn main() { unsafe { while true {} } }"#,
553+
);
554+
check_edit(
555+
"unsafe",
556+
r#"fn main() { for i in 0..10 {}.$0 }"#,
557+
r#"fn main() { unsafe { for i in 0..10 {} } }"#,
558+
);
559+
check_edit(
560+
"unsafe",
561+
r#"fn main() { let x = if true {1} else {2}.$0 }"#,
562+
r#"fn main() { let x = unsafe { if true {1} else {2} } }"#,
563+
);
544564
}
545565

546566
#[test]

0 commit comments

Comments
 (0)