mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Convert bool to ident instead of literal in mbe
This commit is contained in:
parent
b949500126
commit
a1b5cf81eb
5 changed files with 47 additions and 14 deletions
|
@ -1015,6 +1015,36 @@ fn test_literal() {
|
|||
.assert_expand_items(r#"foo!(u8 0);"#, r#"const VALUE : u8 = 0 ;"#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_boolean_is_ident() {
|
||||
parse_macro(
|
||||
r#"
|
||||
macro_rules! foo {
|
||||
($lit0:literal, $lit1:literal) => { const VALUE: (bool,bool) = ($lit0,$lit1); };
|
||||
}
|
||||
"#,
|
||||
)
|
||||
.assert_expand(
|
||||
r#"foo!(true,false);"#,
|
||||
r#"
|
||||
SUBTREE $
|
||||
IDENT const 14
|
||||
IDENT VALUE 15
|
||||
PUNCH : [alone] 16
|
||||
SUBTREE () 17
|
||||
IDENT bool 18
|
||||
PUNCH , [alone] 19
|
||||
IDENT bool 20
|
||||
PUNCH = [alone] 21
|
||||
SUBTREE () 22
|
||||
IDENT true 29
|
||||
PUNCH , [joint] 25
|
||||
IDENT false 31
|
||||
PUNCH ; [alone] 28
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_vis() {
|
||||
parse_macro(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue