mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Add mbe stmt matcher
This commit is contained in:
parent
546d9be2a7
commit
57e4122b89
7 changed files with 136 additions and 89 deletions
|
@ -582,4 +582,19 @@ SOURCE_FILE@[0; 40)
|
|||
);
|
||||
assert_expansion(&rules, "foo! { (a, b) }", "fn foo () {let (a , b) ;}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_stmt() {
|
||||
let rules = create_rules(
|
||||
r#"
|
||||
macro_rules! foo {
|
||||
($ i:stmt) => (
|
||||
fn bar() { $ i; }
|
||||
)
|
||||
}
|
||||
"#,
|
||||
);
|
||||
assert_expansion(&rules, "foo! { 2 }", "fn bar () {2 ;}");
|
||||
assert_expansion(&rules, "foo! { let a = 0 }", "fn bar () {let a = 0 ;}");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue