mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
move test
This commit is contained in:
parent
b21244e080
commit
574df660e4
3 changed files with 27 additions and 22 deletions
|
@ -102,6 +102,7 @@ fn pretty_print_macro_expansion(expn: SyntaxNode) -> String {
|
|||
let space = match (prev_kind, curr_kind) {
|
||||
_ if prev_kind.is_trivia() || curr_kind.is_trivia() => "",
|
||||
(T![=], _) | (_, T![=]) => " ",
|
||||
(_, T!['{']) => " ",
|
||||
(T![;], _) => "\n",
|
||||
(IDENT | LIFETIME_IDENT, IDENT | LIFETIME_IDENT) => " ",
|
||||
(IDENT, _) if curr_kind.is_keyword() => " ",
|
||||
|
|
|
@ -46,3 +46,29 @@ macro_rules! m {
|
|||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tries_all_branches_matching_token_literally() {
|
||||
check(
|
||||
r#"
|
||||
macro_rules! m {
|
||||
($ i:ident) => ( mod $ i {} );
|
||||
(= $ i:ident) => ( fn $ i() {} );
|
||||
(+ $ i:ident) => ( struct $ i; )
|
||||
}
|
||||
m! { foo }
|
||||
m! { = bar }
|
||||
m! { + Baz }
|
||||
"#,
|
||||
expect![[r#"
|
||||
macro_rules! m {
|
||||
($ i:ident) => ( mod $ i {} );
|
||||
(= $ i:ident) => ( fn $ i() {} );
|
||||
(+ $ i:ident) => ( struct $ i; )
|
||||
}
|
||||
mod foo {}
|
||||
fn bar() {}
|
||||
struct Baz;
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue