mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
internal: move some tests
This commit is contained in:
parent
a060b9a4b2
commit
3e8ef943c6
3 changed files with 38 additions and 22 deletions
|
@ -126,6 +126,7 @@ fn pretty_print_macro_expansion(expn: SyntaxNode) -> String {
|
||||||
(T![>], IDENT) => " ",
|
(T![>], IDENT) => " ",
|
||||||
(T![>], _) if curr_kind.is_keyword() => " ",
|
(T![>], _) if curr_kind.is_keyword() => " ",
|
||||||
(T![->], _) | (_, T![->]) => " ",
|
(T![->], _) | (_, T![->]) => " ",
|
||||||
|
(T![&&], _) | (_, T![&&]) => " ",
|
||||||
_ => "",
|
_ => "",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -346,3 +346,40 @@ fn bar() {
|
||||||
"#]],
|
"#]],
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_match_group_with_multichar_sep() {
|
||||||
|
check(
|
||||||
|
r#"
|
||||||
|
macro_rules! m {
|
||||||
|
(fn $name:ident { $($i:literal)* }) => ( fn $name() -> bool { $($i)&&* } );
|
||||||
|
}
|
||||||
|
m! (fn baz { true false } );
|
||||||
|
"#,
|
||||||
|
expect![[r#"
|
||||||
|
macro_rules! m {
|
||||||
|
(fn $name:ident { $($i:literal)* }) => ( fn $name() -> bool { $($i)&&* } );
|
||||||
|
}
|
||||||
|
fn baz() -> bool {
|
||||||
|
true && false
|
||||||
|
}
|
||||||
|
"#]],
|
||||||
|
);
|
||||||
|
|
||||||
|
check(
|
||||||
|
r#"
|
||||||
|
macro_rules! m {
|
||||||
|
(fn $name:ident { $($i:literal)&&* }) => ( fn $name() -> bool { $($i)&&* } );
|
||||||
|
}
|
||||||
|
m! (fn baz { true && false } );
|
||||||
|
"#,
|
||||||
|
expect![[r#"
|
||||||
|
macro_rules! m {
|
||||||
|
(fn $name:ident { $($i:literal)&&* }) => ( fn $name() -> bool { $($i)&&* } );
|
||||||
|
}
|
||||||
|
fn baz() -> bool {
|
||||||
|
true && false
|
||||||
|
}
|
||||||
|
"#]],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
|
@ -71,28 +71,6 @@ macro_rules! foobar {
|
||||||
assert_eq!(get_text(tt::TokenId(13), T!['{']), "{");
|
assert_eq!(get_text(tt::TokenId(13), T!['{']), "{");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_match_group_with_multichar_sep() {
|
|
||||||
parse_macro(
|
|
||||||
r#"
|
|
||||||
macro_rules! foo {
|
|
||||||
(fn $name:ident {$($i:literal)*} ) => ( fn $name() -> bool { $($i)&&*} );
|
|
||||||
}"#,
|
|
||||||
)
|
|
||||||
.assert_expand_items("foo! (fn baz {true true} );", "fn baz () -> bool {true &&true}");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_match_group_with_multichar_sep2() {
|
|
||||||
parse_macro(
|
|
||||||
r#"
|
|
||||||
macro_rules! foo {
|
|
||||||
(fn $name:ident {$($i:literal)&&*} ) => ( fn $name() -> bool { $($i)&&*} );
|
|
||||||
}"#,
|
|
||||||
)
|
|
||||||
.assert_expand_items("foo! (fn baz {true && true} );", "fn baz () -> bool {true &&true}");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_match_group_zero_match() {
|
fn test_match_group_zero_match() {
|
||||||
parse_macro(
|
parse_macro(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue