Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-completion/src/tests/pattern.rs')
-rw-r--r--crates/ide-completion/src/tests/pattern.rs60
1 files changed, 54 insertions, 6 deletions
diff --git a/crates/ide-completion/src/tests/pattern.rs b/crates/ide-completion/src/tests/pattern.rs
index c0e485c36f..8af6cce98f 100644
--- a/crates/ide-completion/src/tests/pattern.rs
+++ b/crates/ide-completion/src/tests/pattern.rs
@@ -1,12 +1,7 @@
//! Completion tests for pattern position.
use expect_test::{expect, Expect};
-use crate::tests::{check_edit, completion_list, BASE_ITEMS_FIXTURE};
-
-fn check_empty(ra_fixture: &str, expect: Expect) {
- let actual = completion_list(ra_fixture);
- expect.assert_eq(&actual)
-}
+use crate::tests::{check_edit, check_empty, completion_list, BASE_ITEMS_FIXTURE};
fn check(ra_fixture: &str, expect: Expect) {
let actual = completion_list(&format!("{BASE_ITEMS_FIXTURE}\n{ra_fixture}"));
@@ -742,3 +737,56 @@ fn f(x: EnumAlias<u8>) {
"#]],
);
}
+
+#[test]
+fn pat_no_unstable_item_on_stable() {
+ check_empty(
+ r#"
+//- /main.rs crate:main deps:std
+use std::*;
+fn foo() {
+ let a$0
+}
+//- /std.rs crate:std
+#[unstable]
+pub struct S;
+#[unstable]
+pub enum Enum {
+ Variant
+}
+"#,
+ expect![[r#"
+ md std
+ kw mut
+ kw ref
+ "#]],
+ );
+}
+
+#[test]
+fn pat_unstable_item_on_nightly() {
+ check_empty(
+ r#"
+//- toolchain:nightly
+//- /main.rs crate:main deps:std
+use std::*;
+fn foo() {
+ let a$0
+}
+//- /std.rs crate:std
+#[unstable]
+pub struct S;
+#[unstable]
+pub enum Enum {
+ Variant
+}
+"#,
+ expect![[r#"
+ en Enum
+ md std
+ st S
+ kw mut
+ kw ref
+ "#]],
+ );
+}