Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-completion/src/tests/item_list.rs')
-rw-r--r--crates/ide-completion/src/tests/item_list.rs55
1 files changed, 55 insertions, 0 deletions
diff --git a/crates/ide-completion/src/tests/item_list.rs b/crates/ide-completion/src/tests/item_list.rs
index 532d4928ef..dfef8fa472 100644
--- a/crates/ide-completion/src/tests/item_list.rs
+++ b/crates/ide-completion/src/tests/item_list.rs
@@ -124,6 +124,7 @@ fn after_unsafe_token() {
r#"unsafe $0"#,
expect![[r#"
kw async
+ kw extern
kw fn
kw impl
kw trait
@@ -495,3 +496,57 @@ type O = $0;
",
)
}
+
+#[test]
+fn inside_extern_blocks() {
+ // Should suggest `fn`, `static`, `unsafe`
+ check(
+ r#"extern { $0 }"#,
+ expect![[r#"
+ ma makro!(…) macro_rules! makro
+ md module
+ kw crate::
+ kw fn
+ kw pub
+ kw pub(crate)
+ kw pub(super)
+ kw self::
+ kw static
+ kw unsafe
+ "#]],
+ );
+
+ // Should suggest `fn`, `static`, `safe`, `unsafe`
+ check(
+ r#"unsafe extern { $0 }"#,
+ expect![[r#"
+ ma makro!(…) macro_rules! makro
+ md module
+ kw crate::
+ kw fn
+ kw pub
+ kw pub(crate)
+ kw pub(super)
+ kw safe
+ kw self::
+ kw static
+ kw unsafe
+ "#]],
+ );
+
+ check(
+ r#"unsafe extern { pub safe $0 }"#,
+ expect![[r#"
+ kw fn
+ kw static
+ "#]],
+ );
+
+ check(
+ r#"unsafe extern { pub unsafe $0 }"#,
+ expect![[r#"
+ kw fn
+ kw static
+ "#]],
+ )
+}