mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 22:31:43 +00:00
negative sign matching in mbe matching for literal
This commit is contained in:
parent
41321d9678
commit
175229ab3d
2 changed files with 39 additions and 6 deletions
|
@ -1008,11 +1008,20 @@ fn test_literal() {
|
|||
parse_macro(
|
||||
r#"
|
||||
macro_rules! foo {
|
||||
($ type:ty $ lit:literal) => { const VALUE: $ type = $ lit;};
|
||||
($ type:ty , $ lit:literal) => { const VALUE: $ type = $ lit;};
|
||||
}
|
||||
"#,
|
||||
)
|
||||
.assert_expand_items(r#"foo!(u8 0);"#, r#"const VALUE : u8 = 0 ;"#);
|
||||
.assert_expand_items(r#"foo!(u8,0);"#, r#"const VALUE : u8 = 0 ;"#);
|
||||
|
||||
parse_macro(
|
||||
r#"
|
||||
macro_rules! foo {
|
||||
($ type:ty , $ lit:literal) => { const VALUE: $ type = $ lit;};
|
||||
}
|
||||
"#,
|
||||
)
|
||||
.assert_expand_items(r#"foo!(i32,-1);"#, r#"const VALUE : i32 = - 1 ;"#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue