mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
move test
This commit is contained in:
parent
408475a593
commit
7e53a3ce23
@ -130,6 +130,7 @@ fn pretty_print_macro_expansion(expn: SyntaxNode) -> String {
|
|||||||
(T![&&], _) | (_, T![&&]) => " ",
|
(T![&&], _) | (_, T![&&]) => " ",
|
||||||
(T![,], _) => " ",
|
(T![,], _) => " ",
|
||||||
(T![fn], T!['(']) => "",
|
(T![fn], T!['(']) => "",
|
||||||
|
(T![']'], _) if curr_kind.is_keyword() => " ",
|
||||||
_ if prev_kind.is_keyword() => " ",
|
_ if prev_kind.is_keyword() => " ",
|
||||||
_ => "",
|
_ => "",
|
||||||
};
|
};
|
||||||
|
@ -936,3 +936,23 @@ fn foo() {
|
|||||||
"#]],
|
"#]],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_meta() {
|
||||||
|
check(
|
||||||
|
r#"
|
||||||
|
macro_rules! m {
|
||||||
|
($m:meta) => ( #[$m] fn bar() {} )
|
||||||
|
}
|
||||||
|
m! { cfg(target_os = "windows") }
|
||||||
|
m! { hello::world }
|
||||||
|
"#,
|
||||||
|
expect![[r##"
|
||||||
|
macro_rules! m {
|
||||||
|
($m:meta) => ( #[$m] fn bar() {} )
|
||||||
|
}
|
||||||
|
#[cfg(target_os = "windows")] fn bar() {}
|
||||||
|
#[hello::world] fn bar() {}
|
||||||
|
"##]],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
@ -101,25 +101,6 @@ fn test_attr_to_token_tree() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_meta() {
|
|
||||||
parse_macro(
|
|
||||||
r#"
|
|
||||||
macro_rules! foo {
|
|
||||||
($ i:meta) => (
|
|
||||||
#[$ i]
|
|
||||||
fn bar() {}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
"#,
|
|
||||||
)
|
|
||||||
.assert_expand_items(
|
|
||||||
r#"foo! { cfg(target_os = "windows") }"#,
|
|
||||||
r#"# [cfg (target_os = "windows")] fn bar () {}"#,
|
|
||||||
)
|
|
||||||
.assert_expand_items(r#"foo! { hello::world }"#, r#"# [hello :: world] fn bar () {}"#);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_meta_doc_comments() {
|
fn test_meta_doc_comments() {
|
||||||
parse_macro(
|
parse_macro(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user