mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
Add builtin derives to attribute completion fixtures
This commit is contained in:
parent
1c034c084d
commit
8f936c5571
1 changed files with 67 additions and 7 deletions
|
@ -83,7 +83,31 @@ mod tests {
|
||||||
use crate::{test_utils::completion_list, CompletionKind};
|
use crate::{test_utils::completion_list, CompletionKind};
|
||||||
|
|
||||||
fn check(ra_fixture: &str, expect: Expect) {
|
fn check(ra_fixture: &str, expect: Expect) {
|
||||||
let actual = completion_list(ra_fixture, CompletionKind::Attribute);
|
let builtin_derives = r#"
|
||||||
|
#[rustc_builtin_macro]
|
||||||
|
pub macro Clone {}
|
||||||
|
#[rustc_builtin_macro]
|
||||||
|
pub macro Copy {}
|
||||||
|
#[rustc_builtin_macro]
|
||||||
|
pub macro Default {}
|
||||||
|
#[rustc_builtin_macro]
|
||||||
|
pub macro Debug {}
|
||||||
|
#[rustc_builtin_macro]
|
||||||
|
pub macro Hash {}
|
||||||
|
#[rustc_builtin_macro]
|
||||||
|
pub macro PartialEq {}
|
||||||
|
#[rustc_builtin_macro]
|
||||||
|
pub macro Eq {}
|
||||||
|
#[rustc_builtin_macro]
|
||||||
|
pub macro PartialOrd {}
|
||||||
|
#[rustc_builtin_macro]
|
||||||
|
pub macro Ord {}
|
||||||
|
|
||||||
|
"#;
|
||||||
|
let actual = completion_list(
|
||||||
|
&format!("{} {}", builtin_derives, ra_fixture),
|
||||||
|
CompletionKind::Attribute,
|
||||||
|
);
|
||||||
expect.assert_eq(&actual);
|
expect.assert_eq(&actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,19 +118,55 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn empty_derive() {
|
fn empty_derive() {
|
||||||
// FIXME: Add build-in derives to fixture.
|
check(
|
||||||
check(r#"#[derive($0)] struct Test;"#, expect![[r#""#]]);
|
r#"#[derive($0)] struct Test;"#,
|
||||||
|
expect![[r#"
|
||||||
|
at PartialEq
|
||||||
|
at Default
|
||||||
|
at PartialEq, Eq
|
||||||
|
at PartialEq, Eq, PartialOrd, Ord
|
||||||
|
at Clone, Copy
|
||||||
|
at Debug
|
||||||
|
at Clone
|
||||||
|
at Hash
|
||||||
|
at PartialEq, PartialOrd
|
||||||
|
"#]],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn derive_with_input() {
|
fn derive_with_input() {
|
||||||
// FIXME: Add build-in derives to fixture.
|
check(
|
||||||
check(r#"#[derive(serde::Serialize, PartialEq, $0)] struct Test;"#, expect![[r#""#]])
|
r#"#[derive(serde::Serialize, PartialEq, $0)] struct Test;"#,
|
||||||
|
expect![[r#"
|
||||||
|
at PartialEq
|
||||||
|
at Default
|
||||||
|
at Eq
|
||||||
|
at Eq, PartialOrd, Ord
|
||||||
|
at Clone, Copy
|
||||||
|
at Debug
|
||||||
|
at Clone
|
||||||
|
at Hash
|
||||||
|
at PartialOrd
|
||||||
|
"#]],
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn derive_with_input2() {
|
fn derive_with_input2() {
|
||||||
// FIXME: Add build-in derives to fixture.
|
check(
|
||||||
check(r#"#[derive($0 serde::Serialize, PartialEq)] struct Test;"#, expect![[r#""#]])
|
r#"#[derive($0 serde::Serialize, PartialEq)] struct Test;"#,
|
||||||
|
expect![[r#"
|
||||||
|
at PartialEq
|
||||||
|
at Default
|
||||||
|
at Eq
|
||||||
|
at Eq, PartialOrd, Ord
|
||||||
|
at Clone, Copy
|
||||||
|
at Debug
|
||||||
|
at Clone
|
||||||
|
at Hash
|
||||||
|
at PartialOrd
|
||||||
|
"#]],
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue