mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 19:58:32 +00:00
Add test for macro generated items
This commit is contained in:
parent
a70a0ca73c
commit
781b514e58
@ -865,6 +865,7 @@ fn main() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn whole_segment() {
|
fn whole_segment() {
|
||||||
|
// Tests that only imports whose last segment matches the identifier get suggested.
|
||||||
check_assist(
|
check_assist(
|
||||||
auto_import,
|
auto_import,
|
||||||
r"
|
r"
|
||||||
@ -883,6 +884,36 @@ fn main() {
|
|||||||
|
|
||||||
struct S;
|
struct S;
|
||||||
impl fmt::Display for S {}
|
impl fmt::Display for S {}
|
||||||
|
",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn macro_generated() {
|
||||||
|
// Tests that macro-generated items are suggested from external crates.
|
||||||
|
check_assist(
|
||||||
|
auto_import,
|
||||||
|
r"
|
||||||
|
//- /lib.rs crate:dep
|
||||||
|
|
||||||
|
macro_rules! mac {
|
||||||
|
() => {
|
||||||
|
pub struct Cheese;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
mac!();
|
||||||
|
|
||||||
|
//- /main.rs crate:main deps:dep
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
Cheese<|>;
|
||||||
|
}",
|
||||||
|
r"use dep::Cheese;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
Cheese;
|
||||||
|
}
|
||||||
",
|
",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user